mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +00:00
Add more POSIX threads APIs
This commit is contained in:
parent
1729a8259c
commit
c3208eb9d5
32 changed files with 592 additions and 87 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue