From b650c255ab437b80a0c7386694888ebbe294f534 Mon Sep 17 00:00:00 2001 From: Dave Korn Date: Thu, 4 Jun 2009 01:45:05 +0000 Subject: [PATCH] * thread.cc (__cygwin_lock_lock): Delete racy optimisation. (__cygwin_lock_unlock): Likewise. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/thread.cc | 18 ++++-------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3bc85a5a1..073c3e48e 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2009-06-04 Dave Korn + + * thread.cc (__cygwin_lock_lock): Delete racy optimisation. + (__cygwin_lock_unlock): Likewise. + + 2009-06-03 IWAMURO Motnori * strfuncs.cc (sys_cp_mbstowcs): Fix condition. diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 8bb68703e..c02310e15 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -76,13 +76,8 @@ __cygwin_lock_fini (_LOCK_T *lock) extern "C" void __cygwin_lock_lock (_LOCK_T *lock) { - if (MT_INTERFACE->threadcount <= 1) - paranoid_printf ("threadcount %d. not locking", MT_INTERFACE->threadcount); - else - { - paranoid_printf ("threadcount %d. locking", MT_INTERFACE->threadcount); - pthread_mutex_lock ((pthread_mutex_t*) lock); - } + paranoid_printf ("threadcount %d. locking", MT_INTERFACE->threadcount); + pthread_mutex_lock ((pthread_mutex_t*) lock); } extern "C" int @@ -95,13 +90,8 @@ __cygwin_lock_trylock (_LOCK_T *lock) extern "C" void __cygwin_lock_unlock (_LOCK_T *lock) { - if (MT_INTERFACE->threadcount <= 1) - paranoid_printf ("threadcount %d. not unlocking", MT_INTERFACE->threadcount); - else - { - pthread_mutex_unlock ((pthread_mutex_t*) lock); - paranoid_printf ("threadcount %d. unlocked", MT_INTERFACE->threadcount); - } + pthread_mutex_unlock ((pthread_mutex_t*) lock); + paranoid_printf ("threadcount %d. unlocked", MT_INTERFACE->threadcount); } static inline verifyable_object_state