From 18f43099f7d52612d8fc38aa55f09a37a826583d Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 30 Sep 2008 02:22:39 +0000 Subject: * 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. --- winsup/cygwin/thread.cc | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) (limited to 'winsup/cygwin/thread.cc') 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), -- cgit v1.2.3