summaryrefslogtreecommitdiff
path: root/sysdeps/generic/pt-cond-timedwait.c
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2002-11-18 22:20:58 +0000
committerNeal H. Walfield <neal@gnu.org>2002-11-18 22:20:58 +0000
commitfea6e6874929ef1b9005adbcdefa38f17287c06d (patch)
tree8ce2f280e49e962766be22acbfad0c6ba68e3704 /sysdeps/generic/pt-cond-timedwait.c
parent9370b15b3013cea65c19ba4afd5b4c4375035774 (diff)
2002-11-18 Neal H. Walfield <neal@cs.uml.edu>
* sysdeps/mach/pt-wakeup.c (__pthread_wakeup): Use the size of THREAD->wakeupmsg which may not be a mach_msg_header_t. * sysdeps/generic/pt-mutex-timedlock.c (__pthread_mutex_timedlock_internal): Really test for equality. * sysdeps/generic/pt-rwlock-timedrdlock.c (__pthread_rwlock_timedrdlock_internal): Likewise. * sysdeps/generic/pt-rwlock-timedwrlock.c (__pthread_rwlock_timedwrlock_internal): Likewise. * sysdeps/generic/pt-cond-timedwait.c (__pthread_cond_timedwait_internal): On timeout, remove our thread structure from the wait queue if necessary. * sysdeps/l4/pt-start.c (__pthread_start): Call L4_Myself, not __mach_thread_self. * sysdeps/mach/hurd/i386/pt-setup.c: Include <mach.h>. (__pthread_setup): Do not leak references from __mach_thread_self. * sysdeps/mach/hurd/pt-docancel.c (__pthread_do_cancel): Likewise. * sysdeps/mach/hurd/pt-sysdep.h (_pthread_self): Likewise. * sysdeps/mach/pt-thread-alloc.c (__pthread_thread_alloc): Likewise. * sysdeps/mach/pt-thread-start.c (__pthread_thread_start): Likewise. * sysdeps/mach/pt-start.c: Remove dead file.
Diffstat (limited to 'sysdeps/generic/pt-cond-timedwait.c')
-rw-r--r--sysdeps/generic/pt-cond-timedwait.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sysdeps/generic/pt-cond-timedwait.c b/sysdeps/generic/pt-cond-timedwait.c
index 99761f3a..4abeb71c 100644
--- a/sysdeps/generic/pt-cond-timedwait.c
+++ b/sysdeps/generic/pt-cond-timedwait.c
@@ -73,7 +73,28 @@ __pthread_cond_timedwait_internal (pthread_cond_t *cond,
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &canceltype);
if (abstime)
- err = __pthread_timedblock (self, abstime);
+ {
+ error_t err;
+
+ err = __pthread_timedblock (self, abstime);
+ if (err)
+ /* We timed out. We may need to disconnect ourself from the
+ waiter queue.
+
+ FIXME: What do we do if we get a wakeup message before we
+ disconnect ourself? It may remain until the next time we
+ block. */
+ {
+ assert (err == ETIMEDOUT);
+
+ __pthread_spin_lock (&mutex->__lock);
+ if (self->prevp)
+ __pthread_dequeue (self);
+ __pthread_spin_unlock (&mutex->__lock);
+
+ return err;
+ }
+ }
else
{
err = 0;