From 24a930fa23ef977dffea3ba331a94c7cb1c1fe61 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Tue, 11 Sep 2001 11:23:41 +0000 Subject: Tue Sep 11 21:22:00 2001 Robert Collins * thread.cc (pthread_cond::~pthread_cond): Bugfix: Incorrect use of InterlockExchangePointer. (pthread_mutex::~pthread_mutex): Ditto. (semaphore::~semaphore): Ditto. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/thread.cc | 19 ++++++------------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8474745b2..3027aea81 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +Tue Sep 11 21:22:00 2001 Robert Collins + + * thread.cc (pthread_cond::~pthread_cond): Bugfix: Incorrect use of InterlockExchangePointer. + (pthread_mutex::~pthread_mutex): Ditto. + (semaphore::~semaphore): Ditto. + Tue Sep 11 18:15:00 2001 Robert Collins * dcrt0.cc (cygwin_finished_initializing): Copy _mtinterf on fork; diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index c4d6c05e8..609bb07f4 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -444,14 +444,14 @@ pthread_cond::~pthread_cond () pthread_mutex_destroy (&cond_access); /* I'm not 100% sure the next bit is threadsafe. I think it is... */ if (MT_INTERFACE->conds == this) - MT_INTERFACE->conds = (pthread_cond *)InterlockedExchangePointer (&MT_INTERFACE->conds, this->next); + InterlockedExchangePointer (&MT_INTERFACE->conds, this->next); else { pthread_cond *tempcond = MT_INTERFACE->conds; while (tempcond->next && tempcond->next != this) tempcond = tempcond->next; /* but there may be a race between the loop above and this statement */ - tempcond->next = (pthread_cond *)InterlockedExchangePointer (&tempcond->next, this->next); + InterlockedExchangePointer (&tempcond->next, this->next); } } @@ -595,13 +595,6 @@ pthread_key::get () *Isn't duplicated, it's reopened. */ -/*FIXME: implement InterlockExchangePointer and get rid of the silly typecasts in pthread_atfork - */ -#ifndef InterlockedExchangePointer -#define InterlockedExchangePointer InterlockedExchange -#endif - - pthread_mutex::pthread_mutex (pthread_mutexattr *attr):verifyable_object (PTHREAD_MUTEX_MAGIC) { /*attr checked in the C call */ @@ -629,14 +622,14 @@ pthread_mutex::~pthread_mutex () win32_obj_id = NULL; /* I'm not 100% sure the next bit is threadsafe. I think it is... */ if (MT_INTERFACE->mutexs == this) - MT_INTERFACE->mutexs = (pthread_mutex *)InterlockedExchangePointer (&MT_INTERFACE->mutexs, this->next); + InterlockedExchangePointer (&MT_INTERFACE->mutexs, this->next); else { pthread_mutex *tempmutex = MT_INTERFACE->mutexs; while (tempmutex->next && tempmutex->next != this) tempmutex = tempmutex->next; /* but there may be a race between the loop above and this statement */ - tempmutex->next = (pthread_mutex *)InterlockedExchangePointer (&tempmutex->next, this->next); + InterlockedExchangePointer (&tempmutex->next, this->next); } } @@ -700,14 +693,14 @@ semaphore::~semaphore () CloseHandle (win32_obj_id); /* I'm not 100% sure the next bit is threadsafe. I think it is... */ if (MT_INTERFACE->semaphores == this) - MT_INTERFACE->semaphores = (semaphore *)InterlockedExchangePointer (&MT_INTERFACE->semaphores, this->next); + InterlockedExchangePointer (&MT_INTERFACE->semaphores, this->next); else { semaphore *tempsem = MT_INTERFACE->semaphores; while (tempsem->next && tempsem->next != this) tempsem = tempsem->next; /* but there may be a race between the loop above and this statement */ - tempsem->next = (semaphore *)InterlockedExchangePointer (&tempsem->next, this->next); + InterlockedExchangePointer (&tempsem->next, this->next); } } -- cgit v1.2.3