2002-05-02 Robert Collins <rbtcollins@hotmail.com>
* thread.cc (__pthread_cond_dowait): Fix a race on signalling from a thread woken by the same condition variable it's signalling on. Thanks to Michael Beach for the report and test case.
This commit is contained in:
parent
4c956a7c0f
commit
37143995da
@ -1,3 +1,9 @@
|
|||||||
|
2002-05-02 Robert Collins <rbtcollins@hotmail.com>
|
||||||
|
|
||||||
|
* thread.cc (__pthread_cond_dowait): Fix a race on signalling from a
|
||||||
|
thread woken by the same condition variable it's signalling on. Thanks
|
||||||
|
to Michael Beach for the report and test case.
|
||||||
|
|
||||||
2002-05-02 Christopher Faylor <cgf@redhat.com>
|
2002-05-02 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* path.h (pathconv_arg): Add PC_POSIX.
|
* path.h (pathconv_arg): Add PC_POSIX.
|
||||||
@ -44,6 +50,7 @@ Wed May 1 16:06:02 2002 Jason Tishler <jason@tishler.net>
|
|||||||
|
|
||||||
* include/cygwin/types.h: Include <sys/sysmacros.h>.
|
* include/cygwin/types.h: Include <sys/sysmacros.h>.
|
||||||
|
|
||||||
|
>>>>>>> 1.1179
|
||||||
Wed Apr 17 11:27:04 2002 Jason Tishler <jason@tishler.net>
|
Wed Apr 17 11:27:04 2002 Jason Tishler <jason@tishler.net>
|
||||||
|
|
||||||
* security.cc (get_lsa_srv_inf): Prevent extraneous backslashes for
|
* security.cc (get_lsa_srv_inf): Prevent extraneous backslashes for
|
||||||
|
@ -1791,20 +1791,22 @@ __pthread_cond_dowait (pthread_cond_t *cond, pthread_mutex_t *mutex,
|
|||||||
InterlockedIncrement (&((*themutex)->condwaits));
|
InterlockedIncrement (&((*themutex)->condwaits));
|
||||||
if (pthread_mutex_unlock (&(*cond)->cond_access))
|
if (pthread_mutex_unlock (&(*cond)->cond_access))
|
||||||
system_printf ("Failed to unlock condition variable access mutex, this %p", *cond);
|
system_printf ("Failed to unlock condition variable access mutex, this %p", *cond);
|
||||||
|
/* At this point calls to Signal will progress evebn if we aren' yet waiting
|
||||||
|
* However, the loop there should allow us to get scheduled and call wait,
|
||||||
|
* and have them call PulseEvent again if we dont' respond.
|
||||||
|
*/
|
||||||
rv = (*cond)->TimedWait (waitlength);
|
rv = (*cond)->TimedWait (waitlength);
|
||||||
/* this may allow a race on the mutex acquisition and waits..
|
/* this may allow a race on the mutex acquisition and waits..
|
||||||
* But doing this within the cond access mutex creates a different race
|
* But doing this within the cond access mutex creates a different race
|
||||||
*/
|
*/
|
||||||
bool last = false;
|
InterlockedDecrement (&((*cond)->waiting));
|
||||||
if (InterlockedDecrement (&((*cond)->waiting)) == 0)
|
|
||||||
last = true;
|
|
||||||
/* Tell Signal that we have been released */
|
/* Tell Signal that we have been released */
|
||||||
InterlockedDecrement (&((*cond)->ExitingWait));
|
InterlockedDecrement (&((*cond)->ExitingWait));
|
||||||
(*themutex)->Lock ();
|
(*themutex)->Lock ();
|
||||||
if (last == true)
|
|
||||||
(*cond)->mutex = NULL;
|
|
||||||
if (pthread_mutex_lock (&(*cond)->cond_access))
|
if (pthread_mutex_lock (&(*cond)->cond_access))
|
||||||
system_printf ("Failed to lock condition variable access mutex, this %p", *cond);
|
system_printf ("Failed to lock condition variable access mutex, this %p", *cond);
|
||||||
|
if ((*cond)->waiting == 0)
|
||||||
|
(*cond)->mutex = NULL;
|
||||||
InterlockedDecrement (&((*themutex)->condwaits));
|
InterlockedDecrement (&((*themutex)->condwaits));
|
||||||
if (pthread_mutex_unlock (&(*cond)->cond_access))
|
if (pthread_mutex_unlock (&(*cond)->cond_access))
|
||||||
system_printf ("Failed to unlock condition variable access mutex, this %p", *cond);
|
system_printf ("Failed to unlock condition variable access mutex, this %p", *cond);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user