26#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 201112L)
57#define thrd_timedout -2
73#define ONCE_FLAG_INIT KTHREAD_ONCE_INIT
103#define mtx_plain (1 << 0)
104#define mtx_recursive (1 << 1)
105#define mtx_timed (1 << 2)
425 struct timespec *remaining);
443#define TSS_DTOR_ITERATIONS 1
#define __RESTRICT
Definition cdefs.h:176
kthread_once_t once_flag
Object type backing call_once.
Definition threads.h:70
condvar_t cnd_t
C11 condition variable type.
Definition threads.h:207
int cnd_init(cnd_t *cond)
Initialize a condition variable.
int(* thrd_start_t)(void *)
C11 thread start function type.
Definition threads.h:315
int thrd_equal(thrd_t thr0, thrd_t thr1)
Compare two threads for equality.
int thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
Create and start a new thread.
int tss_create(tss_t *key, tss_dtor_t dtor)
Create a thread-specific storage pointer.
_Noreturn void thrd_exit(int res)
Terminate the current thread immediately.
mutex_t mtx_t
C11 mutual exclusion lock type.
Definition threads.h:93
void * tss_get(tss_t key)
Retrieve the value associated with a thread-specific storage key.
int mtx_timedlock(mtx_t *__RESTRICT mtx, const struct timespec *__RESTRICT ts)
Lock a mutex lock with a timeout.
int tss_set(tss_t key, void *val)
Set the value associated with a thread-specific storage key.
int cnd_broadcast(cnd_t *cond)
Broadcast to all threads locked on a condition variable.
int thrd_sleep(const struct timespec *duration, struct timespec *remaining)
Put the currently running thread to sleep.
int mtx_init(mtx_t *mtx, int type)
Initialize a mutex lock.
int mtx_lock(mtx_t *mtx)
Lock a mutex lock.
kthread_t * thrd_t
C11 thread identifier type.
Definition threads.h:306
int thrd_join(thrd_t thr, int *res)
Join a running thread.
void cnd_destroy(cnd_t *cond)
Deinitialize a condition variable.
kthread_key_t tss_t
C11 thread-specific storage type.
Definition threads.h:452
thrd_t thrd_current(void)
Return the identifier of the currently running thread.
void call_once(once_flag *flag, void(*func)(void))
Call a function one time, no matter how many threads try.
int cnd_wait(cnd_t *cond, mtx_t *mtx)
Wait on a condition variable.
int mtx_trylock(mtx_t *mtx)
Attempt to acquire a mutex lock.
void thrd_yield(void)
Yield the current thread's timeslice.
int thrd_detach(thrd_t thr)
Detach a running thread.
int cnd_timedwait(cnd_t *__RESTRICT cond, mtx_t *__RESTRICT mtx, const struct timespec *__RESTRICT ts)
Wait on a condition variable (with a timeout).
int mtx_unlock(mtx_t *mtx)
Unlock a previously acquired lock.
void mtx_destroy(mtx_t *mtx)
Deinitialize a mutex lock.
void tss_delete(tss_t key)
Free resources associated with a thread-specific storage key.
int cnd_signal(cnd_t *cond)
Signal one thread locked on a condition variable.
void(* tss_dtor_t)(void *)
C11 thread-specific storage destructor type.
Definition threads.h:461
Dynamic package initialization.
volatile int kthread_once_t
Object type backing kthread_once.
Definition once.h:35
Condition variable.
Definition cond.h:62
Structure describing one running thread.
Definition thread.h:169
Mutual exclusion lock type.
Definition mutex.h:68
KOS-implementation of select C11 and POSIX extensions.
Thread-local storage support.
int kthread_key_t
Thread-local storage key type.
Definition tls.h:28