summaryrefslogtreecommitdiffstats
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2008-09-30 02:22:39 +0000
committerChristopher Faylor <me@cgf.cx>2008-09-30 02:22:39 +0000
commit18f43099f7d52612d8fc38aa55f09a37a826583d (patch)
tree663102b3acb79d5f845fd6bf3dd9f8efbdafa38b /winsup
parente7afe579f5f91c6a3065a13127284930b29a6296 (diff)
downloadcygnal-18f43099f7d52612d8fc38aa55f09a37a826583d.tar.gz
cygnal-18f43099f7d52612d8fc38aa55f09a37a826583d.tar.bz2
cygnal-18f43099f7d52612d8fc38aa55f09a37a826583d.zip
* thread.cc (pthread_mutex::_fixup_after_fork): Just reset lock to pristine
state after fork. Don't recreate a mutex since it may not actually be needed.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/thread.cc28
2 files changed, 12 insertions, 22 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 176c17a19..12e1156aa 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-29 Christopher Faylor <me+cygwin@cgf.cx>
+
+ * thread.cc (pthread_mutex::_fixup_after_fork): Just reset lock to
+ pristine state after fork. Don't recreate a mutex since it may not
+ actually be needed.
+
2008-09-29 Corinna Vinschen <corinna@vinschen.de>
* flock.cc (inode_t::get_all_locks_list): Fix typo.
diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc
index 73007386b..08ac0c501 100644
--- a/winsup/cygwin/thread.cc
+++ b/winsup/cygwin/thread.cc
@@ -1673,30 +1673,14 @@ pthread_mutex::_fixup_after_fork ()
{
debug_printf ("mutex %x in _fixup_after_fork", this);
if (pshared != PTHREAD_PROCESS_PRIVATE)
- api_fatal ("pthread_mutex::_fixup_after_fork () doesn'tunderstand PROCESS_SHARED mutex's");
-
- if (owner == NULL)
- {
- /* mutex has no owner, reset to initial */
- lock_counter = 0;
-#ifdef DEBUGGING
- tid = 0;
-#endif
- }
- else if (lock_counter != 0)
- {
- /* All waiting threads are gone after a fork */
- lock_counter = 1;
-#ifdef DEBUGGING
- tid = 0xffffffff; /* Don't know the tid after a fork */
-#endif
- }
-
- win32_obj_id = ::CreateSemaphore (&sec_none_nih, 0, LONG_MAX, NULL);
- if (!win32_obj_id)
- api_fatal ("pthread_mutex::_fixup_after_fork () failed to recreate win32 semaphore for mutex");
+ api_fatal ("pthread_mutex::_fixup_after_fork () doesn't understand PROCESS_SHARED mutex's");
+ /* All waiting threads are gone after a fork */
+ lock_counter = 0;
+ owner = NULL;
+ win32_obj_id = NULL;
condwaits = 0;
+ tid = 0; /* Don't know the tid after a fork */
}
pthread_mutexattr::pthread_mutexattr ():verifyable_object (PTHREAD_MUTEXATTR_MAGIC),