summaryrefslogtreecommitdiff
path: root/linuxthreads/condvar.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-26 02:18:41 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-26 02:18:41 +0000
commit9ec9e34ee301ccfa4216939639be5498831f9d37 (patch)
treee61a7957abfbeb4816cb6dc545c116b8e18159b5 /linuxthreads/condvar.c
parenta956d04575bbd053a1ff61a05a5526867633d0d0 (diff)
Update.
* internals.h (strict __pthread_descr_struct): Add p_sem_avail. * semaphore.c: Handle spurious wakeups. * sysdeps/pthread/pthread.h: Add back PTHREAD_MUTX_FAST_NP as an alias for PTHREAD_MUTEX_ADAPTIVE_NP for source code compatibility. * pthread.c (__pthread_set_own_extricate): Use THREAD_GETMEM. (__pthread_wait_for_restart): Likewise. * condvar.c (pthread_cond_wait): Also check whether thread is cancelable before aborting loop. (pthread_cond_timedwait): Likewise.
Diffstat (limited to 'linuxthreads/condvar.c')
-rw-r--r--linuxthreads/condvar.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/linuxthreads/condvar.c b/linuxthreads/condvar.c
index ae1cef1ea9..f9c46a3316 100644
--- a/linuxthreads/condvar.c
+++ b/linuxthreads/condvar.c
@@ -103,7 +103,8 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
suspend(self);
if (THREAD_GETMEM(self, p_condvar_avail) == 0
- && THREAD_GETMEM(self, p_woken_by_cancel) == 0)
+ && (THREAD_GETMEM(self, p_woken_by_cancel) == 0
+ || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE))
{
/* Count resumes that don't belong to us. */
spurious_wakeup_count++;
@@ -196,7 +197,8 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond,
}
if (THREAD_GETMEM(self, p_condvar_avail) == 0
- && THREAD_GETMEM(self, p_woken_by_cancel) == 0)
+ && (THREAD_GETMEM(self, p_woken_by_cancel) == 0
+ || THREAD_GETMEM(self, p_cancelstate) != PTHREAD_CANCEL_ENABLE))
{
/* Count resumes that don't belong to us. */
spurious_wakeup_count++;