Tue Sep 11 21:22:00 2001 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (pthread_cond::~pthread_cond): Bugfix: Incorrect use of InterlockExchangePointer. (pthread_mutex::~pthread_mutex): Ditto. (semaphore::~semaphore): Ditto.
This commit is contained in:
parent
f9229ef74b
commit
24a930fa23
@ -1,3 +1,9 @@
|
|||||||
|
Tue Sep 11 21:22:00 2001 Robert Collins <rbtcollins@hotmail.com>
|
||||||
|
|
||||||
|
* 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 <rbtcollins@hotmail.com>
|
Tue Sep 11 18:15:00 2001 Robert Collins <rbtcollins@hotmail.com>
|
||||||
|
|
||||||
* dcrt0.cc (cygwin_finished_initializing): Copy _mtinterf on fork;
|
* dcrt0.cc (cygwin_finished_initializing): Copy _mtinterf on fork;
|
||||||
|
@ -444,14 +444,14 @@ pthread_cond::~pthread_cond ()
|
|||||||
pthread_mutex_destroy (&cond_access);
|
pthread_mutex_destroy (&cond_access);
|
||||||
/* I'm not 100% sure the next bit is threadsafe. I think it is... */
|
/* I'm not 100% sure the next bit is threadsafe. I think it is... */
|
||||||
if (MT_INTERFACE->conds == this)
|
if (MT_INTERFACE->conds == this)
|
||||||
MT_INTERFACE->conds = (pthread_cond *)InterlockedExchangePointer (&MT_INTERFACE->conds, this->next);
|
InterlockedExchangePointer (&MT_INTERFACE->conds, this->next);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pthread_cond *tempcond = MT_INTERFACE->conds;
|
pthread_cond *tempcond = MT_INTERFACE->conds;
|
||||||
while (tempcond->next && tempcond->next != this)
|
while (tempcond->next && tempcond->next != this)
|
||||||
tempcond = tempcond->next;
|
tempcond = tempcond->next;
|
||||||
/* but there may be a race between the loop above and this statement */
|
/* 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.
|
*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)
|
pthread_mutex::pthread_mutex (pthread_mutexattr *attr):verifyable_object (PTHREAD_MUTEX_MAGIC)
|
||||||
{
|
{
|
||||||
/*attr checked in the C call */
|
/*attr checked in the C call */
|
||||||
@ -629,14 +622,14 @@ pthread_mutex::~pthread_mutex ()
|
|||||||
win32_obj_id = NULL;
|
win32_obj_id = NULL;
|
||||||
/* I'm not 100% sure the next bit is threadsafe. I think it is... */
|
/* I'm not 100% sure the next bit is threadsafe. I think it is... */
|
||||||
if (MT_INTERFACE->mutexs == this)
|
if (MT_INTERFACE->mutexs == this)
|
||||||
MT_INTERFACE->mutexs = (pthread_mutex *)InterlockedExchangePointer (&MT_INTERFACE->mutexs, this->next);
|
InterlockedExchangePointer (&MT_INTERFACE->mutexs, this->next);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pthread_mutex *tempmutex = MT_INTERFACE->mutexs;
|
pthread_mutex *tempmutex = MT_INTERFACE->mutexs;
|
||||||
while (tempmutex->next && tempmutex->next != this)
|
while (tempmutex->next && tempmutex->next != this)
|
||||||
tempmutex = tempmutex->next;
|
tempmutex = tempmutex->next;
|
||||||
/* but there may be a race between the loop above and this statement */
|
/* 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);
|
CloseHandle (win32_obj_id);
|
||||||
/* I'm not 100% sure the next bit is threadsafe. I think it is... */
|
/* I'm not 100% sure the next bit is threadsafe. I think it is... */
|
||||||
if (MT_INTERFACE->semaphores == this)
|
if (MT_INTERFACE->semaphores == this)
|
||||||
MT_INTERFACE->semaphores = (semaphore *)InterlockedExchangePointer (&MT_INTERFACE->semaphores, this->next);
|
InterlockedExchangePointer (&MT_INTERFACE->semaphores, this->next);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
semaphore *tempsem = MT_INTERFACE->semaphores;
|
semaphore *tempsem = MT_INTERFACE->semaphores;
|
||||||
while (tempsem->next && tempsem->next != this)
|
while (tempsem->next && tempsem->next != this)
|
||||||
tempsem = tempsem->next;
|
tempsem = tempsem->next;
|
||||||
/* but there may be a race between the loop above and this statement */
|
/* 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user