Introduce pthread_rwlock_try{rd,wr}lock

This also changes recursive mutexes to favor cpu over scheduler yield.
This commit is contained in:
Justine Tunney 2023-10-31 21:59:05 -07:00
parent a1e1e821cb
commit fadb64a2bf
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
13 changed files with 122 additions and 29 deletions

View file

@ -19,6 +19,7 @@
#include "libc/assert.h"
#include "libc/dce.h"
#include "libc/intrin/atomic.h"
#include "libc/nexgen32e/yield.h"
#include "libc/thread/posixthread.internal.h"
intptr_t _pthread_syshand(struct PosixThread *pt) {
@ -27,6 +28,6 @@ intptr_t _pthread_syshand(struct PosixThread *pt) {
for (;;) {
syshand = atomic_load_explicit(&pt->tib->tib_syshand, memory_order_acquire);
if (syshand) return syshand;
pthread_yield();
spin_yield();
}
}