mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-28 15:28:30 +00:00
Use futexes on OpenBSD and improve threading
This commit is contained in:
parent
5b11033d4d
commit
4f4889ddf7
17 changed files with 114 additions and 63 deletions
|
@ -137,11 +137,10 @@ void *pthread_getspecific(pthread_key_t);
|
|||
!atomic_exchange(&(mutex)->lock, 1)) \
|
||||
? 0 \
|
||||
: pthread_mutex_lock(mutex))
|
||||
|
||||
#define pthread_mutex_unlock(mutex) \
|
||||
((mutex)->attr == PTHREAD_MUTEX_NORMAL \
|
||||
? (atomic_store_explicit(&(mutex)->lock, 0, memory_order_relaxed), \
|
||||
((IsLinux() /* || IsOpenbsd() */) && \
|
||||
((IsLinux() || IsOpenbsd()) && \
|
||||
atomic_load_explicit(&(mutex)->waits, memory_order_relaxed) && \
|
||||
_pthread_mutex_wake(mutex)), \
|
||||
0) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue