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

@ -18,7 +18,6 @@
*/
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/atomic.h"
#include "libc/intrin/futex.internal.h"
#include "libc/intrin/pthread.h"
@ -37,10 +36,8 @@ void _wait0(const int *ctid) {
for (;;) {
if (!(x = atomic_load_explicit(ctid, memory_order_relaxed))) {
break;
} else if (IsLinux() || IsOpenbsd()) {
_futex_wait(ctid, x, PTHREAD_PROCESS_SHARED, &(struct timespec){2});
} else {
pthread_yield();
_futex_wait(ctid, x, PTHREAD_PROCESS_SHARED, &(struct timespec){2});
}
}
if (IsOpenbsd()) {