diff options
author | Russ Cox <rsc@swtch.com> | 2020-05-17 22:31:38 -0400 |
---|---|---|
committer | Russ Cox <rsc@swtch.com> | 2020-05-17 23:18:33 -0400 |
commit | 162d0d5cd94fabab822ac66655be8957151cef99 (patch) | |
tree | 4c31c0aa2e00135bd27f7279864e2543b8ace239 /src/libthread/pthread.c | |
parent | baef953da253314657be9adea8f371bfbf4ba09e (diff) | |
download | plan9port-162d0d5cd94fabab822ac66655be8957151cef99.tar.gz plan9port-162d0d5cd94fabab822ac66655be8957151cef99.tar.bz2 plan9port-162d0d5cd94fabab822ac66655be8957151cef99.zip |
libthread: handle spurious _procsleep wakeups, fix $LIBTHREAD handling
Diffstat (limited to 'src/libthread/pthread.c')
-rw-r--r-- | src/libthread/pthread.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libthread/pthread.c b/src/libthread/pthread.c index 5e022f0b..35f6ffe3 100644 --- a/src/libthread/pthread.c +++ b/src/libthread/pthread.c @@ -50,13 +50,15 @@ _threadunlock(Lock *lk, ulong pc) abort(); } +/* note: _procsleep can have spurious wakeups, like pthread_cond_wait */ void _procsleep(_Procrendez *r) { /* r is protected by r->l, which we hold */ pthread_cond_init(&r->cond, 0); r->asleep = 1; - pthread_cond_wait(&r->cond, &r->l->mutex); + if(pthread_cond_wait(&r->cond, &r->l->mutex) != 0) + sysfatal("pthread_cond_wait: %r"); pthread_cond_destroy(&r->cond); r->asleep = 0; } |