mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-31 11:30:56 +08:00
2001-06-22 Robert Collins rbtcollins@hotmail.com
* thread.cc (__pthread_cond_timedwait): Lock the waiting mutex before the condition protect mutex to avoid deadlocking. (Found by Greg Smith). (__pthread_cond_wait): Ditto.
This commit is contained in:
parent
9cc97acbd0
commit
b643afa4c7
@ -1,3 +1,9 @@
|
|||||||
|
2001-06-22 Robert COllins <rbbtcollins@hotmail.com>
|
||||||
|
|
||||||
|
* thread.cc (__pthread_cond_timedwait): Lock the waiting mutex before
|
||||||
|
the condition protect mutex to avoid deadlocking. (Found by Greg Smith).
|
||||||
|
(__pthread_cond_wait): Ditto.
|
||||||
|
|
||||||
2001-06-30 Egor Duda <deo@logos-m.ru>
|
2001-06-30 Egor Duda <deo@logos-m.ru>
|
||||||
|
|
||||||
* fhandler.cc (fhandler_base::open): Work around windows bug when
|
* fhandler.cc (fhandler_base::open): Work around windows bug when
|
||||||
|
@ -1672,9 +1672,9 @@ __pthread_cond_timedwait (pthread_cond_t * cond, pthread_mutex_t * mutex,
|
|||||||
if (pthread_mutex_unlock (&(*cond)->cond_access))
|
if (pthread_mutex_unlock (&(*cond)->cond_access))
|
||||||
system_printf ("Failed to unlock condition variable access mutex, this %0p\n", *cond);
|
system_printf ("Failed to unlock condition variable access mutex, this %0p\n", *cond);
|
||||||
rv = (*cond)->TimedWait (abstime->tv_sec * 1000);
|
rv = (*cond)->TimedWait (abstime->tv_sec * 1000);
|
||||||
|
(*cond)->mutex->Lock ();
|
||||||
if (pthread_mutex_lock (&(*cond)->cond_access))
|
if (pthread_mutex_lock (&(*cond)->cond_access))
|
||||||
system_printf ("Failed to lock condition variable access mutex, this %0p\n", *cond);
|
system_printf ("Failed to lock condition variable access mutex, this %0p\n", *cond);
|
||||||
(*cond)->mutex->Lock ();
|
|
||||||
if (InterlockedDecrement (&((*cond)->waiting)) == 0)
|
if (InterlockedDecrement (&((*cond)->waiting)) == 0)
|
||||||
(*cond)->mutex = NULL;
|
(*cond)->mutex = NULL;
|
||||||
InterlockedDecrement (&((*themutex)->condwaits));
|
InterlockedDecrement (&((*themutex)->condwaits));
|
||||||
@ -1719,9 +1719,9 @@ __pthread_cond_wait (pthread_cond_t * cond, pthread_mutex_t * mutex)
|
|||||||
if (pthread_mutex_unlock (&(*cond)->cond_access))
|
if (pthread_mutex_unlock (&(*cond)->cond_access))
|
||||||
system_printf ("Failed to unlock condition variable access mutex, this %0p\n", *cond);
|
system_printf ("Failed to unlock condition variable access mutex, this %0p\n", *cond);
|
||||||
rv = (*cond)->TimedWait (INFINITE);
|
rv = (*cond)->TimedWait (INFINITE);
|
||||||
|
(*cond)->mutex->Lock ();
|
||||||
if (pthread_mutex_lock (&(*cond)->cond_access))
|
if (pthread_mutex_lock (&(*cond)->cond_access))
|
||||||
system_printf ("Failed to lock condition variable access mutex, this %0p\n", *cond);
|
system_printf ("Failed to lock condition variable access mutex, this %0p\n", *cond);
|
||||||
(*cond)->mutex->Lock ();
|
|
||||||
if (InterlockedDecrement (&((*cond)->waiting)) == 0)
|
if (InterlockedDecrement (&((*cond)->waiting)) == 0)
|
||||||
(*cond)->mutex = NULL;
|
(*cond)->mutex = NULL;
|
||||||
InterlockedDecrement (&((*themutex)->condwaits));
|
InterlockedDecrement (&((*themutex)->condwaits));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user