36#include <sys/features.h>
50#define PTHREAD_PROCESS_PRIVATE 0
51#define PTHREAD_PROCESS_SHARED 1
55#define PTHREAD_SCOPE_PROCESS 0
56#define PTHREAD_SCOPE_SYSTEM 1
58#define PTHREAD_CANCEL_DISABLE 0
59#define PTHREAD_CANCEL_ENABLE 1
61#define PTHREAD_CANCEL_DEFERRED 0
62#define PTHREAD_CANCEL_ASYNCHRONOUS 1
64#define PTHREAD_CREATE_DETACHED 0
65#define PTHREAD_CREATE_JOINABLE 1
67#define PTHREAD_STACK_MIN 256
68#define PTHREAD_STACK_MIN_ALIGNMENT 32
73 void *(*start_routine)(
void *),
void *
__RESTRICT arg);
76void pthread_exit(
void *value_ptr);
81#if __GNU_VISIBLE || __BSD_VISIBLE
97int pthread_attr_setdetachstate(
pthread_attr_t *attr,
int detachstate);
101int pthread_attr_setguardsize(
pthread_attr_t *attr,
size_t guardsize);
111 void *
__RESTRICT stackaddr,
size_t stacksize);
118int pthread_attr_setscope(
pthread_attr_t *attr,
int contentionscope);
126void pthread_testcancel(
void);
127int pthread_setcancelstate(
int state,
int *oldstate);
128int pthread_setcanceltype(
int type,
int *oldtype);
135#define PTHREAD_COND_INITIALIZER { .cond = COND_INITIALIZER }
154typedef int pthread_key_t;
155int pthread_key_create(pthread_key_t *
key,
void (*
destructor)(
void *));
156int pthread_key_delete(pthread_key_t
key);
157void *pthread_getspecific(pthread_key_t
key);
158int pthread_setspecific(pthread_key_t
key,
const void *value);
165#define PTHREAD_MUTEX_INITIALIZER { .mutex = MUTEX_INITIALIZER }
166#define PTHREAD_MUTEX_NORMAL 0
167#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
168#define PTHREAD_MUTEX_ERRORCHECK 2
169#define PTHREAD_MUTEX_RECURSIVE 3
171#define PTHREAD_MUTEX_ROBUST 0
172#define PTHREAD_MUTEX_STALLED 1
193typedef volatile int pthread_once_t;
194#define PTHREAD_ONCE_INIT 0
196int pthread_once(pthread_once_t *once_control,
void (*init_routine)(
void));
203#define PTHREAD_RWLOCK_INITIALIZER { .rwsem = RWSEM_INITIALIZER }
219typedef volatile int pthread_spinlock_t;
221int pthread_spin_init(pthread_spinlock_t *
lock,
int pshared);
222int pthread_spin_destroy(pthread_spinlock_t *
lock);
223int pthread_spin_lock(pthread_spinlock_t *
lock);
224int pthread_spin_trylock(pthread_spinlock_t *
lock);
225int pthread_spin_unlock(pthread_spinlock_t *
lock);
228#define PTHREAD_BARRIER_SERIAL_THREAD 0x7fffffff
240int pthread_getconcurrency(
void);
241int pthread_setconcurrency(
int new_level);
242int pthread_atfork(
void (*prepare)(
void),
void (*parent)(
void),
243 void (*child)(
void));
245#if __GNU_VISIBLE || __BSD_VISIBLE
248int pthread_yield(
void);
unsigned long int pthread_t
Definition _pthreadtypes.h:18
static int thread(void *arg)
Definition atomics.c:112
thd_barrier_t barrier
Definition barrier.c:37
Various common macros used throughout the codebase.
void * thd(void *v)
Definition compiler_tls.c:63
int key
Definition nehe26.c:48
int cond[LOCSIZ]
Definition globalvars.c:35
#define __RESTRICT
Definition cdefs.h:98
int at(int objj)
Definition subr.c:79
static mutex_t lock
Definition once_test.c:30
static int buflen
Definition porthelper.c:12
Definition for a reader/writer semaphore.
Definition _pthreadtypes.h:42
Definition _pthreadtypes.h:20
Definition _pthreadtypes.h:25
KOS-implementation of select C11 and POSIX extensions.
static void destructor(void *data)
Definition tls_test.c:35
Definition _pthreadtypes.h:54
Definition _pthreadtypes.h:105
Definition _pthreadtypes.h:79
Definition _pthreadtypes.h:34
Definition _pthreadtypes.h:66
Definition _pthreadtypes.h:92