diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-02-13 08:17:12 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-02-13 08:17:12 +0000 |
commit | 466618568dd9045eaf0e9ce505d1e2c9edd47243 (patch) | |
tree | 11c4502a190e76e3676178c79d90cdad12088fb7 /linuxthreads/condvar.c | |
parent | b02b9253e0c1770707ed791f0aa274af79886932 (diff) | |
download | glibc-466618568dd9045eaf0e9ce505d1e2c9edd47243.tar.gz glibc-466618568dd9045eaf0e9ce505d1e2c9edd47243.tar.xz glibc-466618568dd9045eaf0e9ce505d1e2c9edd47243.zip |
Update.
2000-02-12 Andreas Jaeger <aj@suse.de> * sysdeps/unix/sysv/linux/i386/msgctl.c (__new_msgctl): Move errno declaration to place where it's needed to avoid compiler warning. * sysdeps/unix/sysv/linux/i386/semctl.c (__new_semctl): Likewise. * locale/weightwc.h (findidx): Correct find index value.
Diffstat (limited to 'linuxthreads/condvar.c')
-rw-r--r-- | linuxthreads/condvar.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/linuxthreads/condvar.c b/linuxthreads/condvar.c index c0c619992d..b1cde4d9f3 100644 --- a/linuxthreads/condvar.c +++ b/linuxthreads/condvar.c @@ -134,11 +134,25 @@ pthread_cond_timedwait_relative_old(pthread_cond_t *cond, { volatile pthread_descr self = thread_self(); sigset_t unblock, initial_mask; +#ifdef NANOSLEEP_WORKS int already_canceled = 0; int was_signalled = 0; +#else + int retsleep; + int already_canceled; + int was_signalled; +#endif sigjmp_buf jmpbuf; pthread_extricate_if extr; +#ifndef NANOSLEEP_WORKS + requeue_and_wait_again: + + retsleep = 0; + already_canceled = 0; + was_signalled = 0; +#endif + /* Set up extrication interface */ extr.pu_object = cond; extr.pu_extricate_func = cond_extricate_func; @@ -173,14 +187,22 @@ pthread_cond_timedwait_relative_old(pthread_cond_t *cond, sigemptyset(&unblock); sigaddset(&unblock, __pthread_sig_restart); sigprocmask(SIG_UNBLOCK, &unblock, &initial_mask); +#ifdef NANOSLEEP_WORKS /* Sleep for the required duration. If woken by a signal, resume waiting as required by Single Unix Specification. */ while (__libc_nanosleep(reltime, reltime) != 0) ; +#else + /* Sleep for the required duration */ + retsleep = __libc_nanosleep(&reltime, NULL); +#endif /* Block the restart signal again */ sigprocmask(SIG_SETMASK, &initial_mask, NULL); was_signalled = 0; } else { +#ifndef NANOSLEEP_WORKS + retsleep = -1; +#endif was_signalled = 1; } THREAD_SETMEM(self, p_signal_jmp, NULL); @@ -212,7 +234,15 @@ pthread_cond_timedwait_relative_old(pthread_cond_t *cond, if (was_on_queue) { __pthread_set_own_extricate_if(self, 0); pthread_mutex_lock(mutex); +#ifdef NANOSLEEP_WORKS return ETIMEDOUT; +#else + if (retsleep == 0) + return ETIMEDOUT; + /* Woken by a signal: resume waiting as required by Single Unix + Specification. */ + goto requeue_and_wait_again; +#endif } suspend(self); @@ -245,14 +275,28 @@ pthread_cond_timedwait_relative_new(pthread_cond_t *cond, { volatile pthread_descr self = thread_self(); sigset_t unblock, initial_mask; +#ifdef NANOSLEEP_WORKS int already_canceled = 0; int was_signalled = 0; +#else + int retsleep; + int already_canceled; + int was_signalled; +#endif sigjmp_buf jmpbuf; pthread_extricate_if extr; already_canceled = 0; was_signalled = 0; +#ifndef NANOSLEEP_WORKS + requeue_and_wait_again: + + retsleep = 0; + already_canceled = 0; + was_signalled = 0; +#endif + /* Set up extrication interface */ extr.pu_object = cond; extr.pu_extricate_func = cond_extricate_func; @@ -286,14 +330,22 @@ pthread_cond_timedwait_relative_new(pthread_cond_t *cond, sigemptyset(&unblock); sigaddset(&unblock, __pthread_sig_restart); sigprocmask(SIG_UNBLOCK, &unblock, &initial_mask); +#ifdef NANOSLEEP_WORKS /* Sleep for the required duration. If woken by a signal, resume waiting as required by Single Unix Specification. */ while (__libc_nanosleep(reltime, reltime) != 0) ; +#else + /* Sleep for the required duration */ + retsleep = __libc_nanosleep(&reltime, NULL); +#endif /* Block the restart signal again */ sigprocmask(SIG_SETMASK, &initial_mask, NULL); was_signalled = 0; } else { +#ifndef NANOSLEEP_WORKS + retsleep = -1; +#endif was_signalled = 1; } THREAD_SETMEM(self, p_signal_jmp, NULL); @@ -322,7 +374,15 @@ pthread_cond_timedwait_relative_new(pthread_cond_t *cond, if (was_on_queue) { __pthread_set_own_extricate_if(self, 0); pthread_mutex_lock(mutex); +#ifdef NANOSLEEP_WORKS return ETIMEDOUT; +#else + if (retsleep == 0) + return ETIMEDOUT; + /* Woken by a signal: resume waiting as required by Single Unix + Specification. */ + goto requeue_and_wait_again; +#endif } /* Eat the outstanding restart() from the signaller */ |