mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-26 22:38:30 +00:00
Add more missing libc/libc++ functions
- Add sched_rr_get_interval() - Add `unbuffer` command example - Add more locale function stubs - Vendor most of remaining libcxx content
This commit is contained in:
parent
5a2bb07b36
commit
31e746c937
76 changed files with 15519 additions and 157 deletions
|
@ -1,6 +1,5 @@
|
|||
#ifndef COSMOPOLITAN_LIBC_RUNTIME_PTHREAD_H_
|
||||
#define COSMOPOLITAN_LIBC_RUNTIME_PTHREAD_H_
|
||||
#include "libc/bits/atomic.h"
|
||||
#include "libc/calls/struct/timespec.h"
|
||||
#include "libc/dce.h"
|
||||
|
||||
|
@ -130,20 +129,20 @@ void *pthread_getspecific(pthread_key_t);
|
|||
})
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define pthread_mutex_lock(mutex) \
|
||||
(((mutex)->attr == PTHREAD_MUTEX_NORMAL && \
|
||||
!atomic_load_explicit(&(mutex)->lock, memory_order_relaxed) && \
|
||||
!atomic_exchange(&(mutex)->lock, 1)) \
|
||||
? 0 \
|
||||
#if (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 407
|
||||
#define pthread_mutex_lock(mutex) \
|
||||
(((mutex)->attr == PTHREAD_MUTEX_NORMAL && \
|
||||
!__atomic_load_n(&(mutex)->lock, __ATOMIC_RELAXED) && \
|
||||
!__atomic_exchange_n(&(mutex)->lock, 1, __ATOMIC_SEQ_CST)) \
|
||||
? 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()) && \
|
||||
atomic_load_explicit(&(mutex)->waits, memory_order_relaxed) && \
|
||||
_pthread_mutex_wake(mutex)), \
|
||||
0) \
|
||||
#define pthread_mutex_unlock(mutex) \
|
||||
((mutex)->attr == PTHREAD_MUTEX_NORMAL \
|
||||
? (__atomic_store_n(&(mutex)->lock, 0, __ATOMIC_RELAXED), \
|
||||
((IsLinux() || IsOpenbsd()) && \
|
||||
__atomic_load_n(&(mutex)->waits, __ATOMIC_RELAXED) && \
|
||||
_pthread_mutex_wake(mutex)), \
|
||||
0) \
|
||||
: pthread_mutex_unlock(mutex))
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue