Add more POSIX threads APIs

This commit is contained in:
Justine Tunney 2022-09-09 11:30:33 -07:00
parent 1729a8259c
commit c3208eb9d5
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
32 changed files with 592 additions and 87 deletions

View file

@ -19,7 +19,6 @@
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/timespec.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/atomic.h"
#include "libc/intrin/futex.internal.h"
@ -77,11 +76,7 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
rel = _timespec_sub(*abstime, now);
tsp = &rel;
}
if (IsLinux() || IsOpenbsd()) {
_futex_wait(&cond->seq, seq, cond->pshared, tsp);
} else {
sched_yield();
}
_futex_wait(&cond->seq, seq, cond->pshared, tsp);
} while (seq == atomic_load_explicit(&cond->seq, memory_order_relaxed));
atomic_fetch_sub(&cond->waits, 1);