# pthread.h ## **Overview** **Related Modules:** [PROCESS](PROCESS.md) **Description:** Provides process- and thread-related structures \(providing fields such as thread attributes\) and functions \(including the functions for creating and destroying threads, and setting the thread detach state and blocking conditions\). **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Functions
pthread_create (pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) |
|
pthread_detach (pthread_t thread) |
|
pthread_exit (void *retval) |
|
pthread_join (pthread_t thread, void **retval) |
|
pthread_self (void) |
|
pthread_equal (pthread_t t1, pthread_t t2) |
|
pthread_setcancelstate (int state, int *oldstate) |
|
pthread_setcanceltype (int type, int *oldtype) |
|
pthread_testcancel (void) |
|
pthread_cancel (pthread_t thread) |
|
pthread_kill (pthread_t thread, int sig) |
|
pthread_getschedparam (pthread_t thread, int *policy, struct sched_param *param) |
|
pthread_setschedparam (pthread_t thread, int policy, const struct sched_param *param) |
|
pthread_setschedprio (pthread_t thread, int prio) |
|
pthread_once (pthread_once_t *once_control, void(*init_routine)(void)) |
|
pthread_mutex_init (pthread_mutex_t *__restrict m, const pthread_mutexattr_t *__restrict a) |
|
pthread_mutex_lock (pthread_mutex_t *m) |
|
pthread_mutex_unlock (pthread_mutex_t *m) |
|
pthread_mutex_trylock (pthread_mutex_t *m) |
|
pthread_mutex_timedlock (pthread_mutex_t *__restrict m, const struct timespec *__restrict at) |
|
pthread_mutex_destroy (pthread_mutex_t *m) |
|
pthread_cond_init (pthread_cond_t *__restrict c, const pthread_condattr_t *__restrict a) |
|
pthread_cond_destroy (pthread_cond_t *c) |
|
pthread_cond_wait (pthread_cond_t *__restrict c, pthread_mutex_t *__restrict m) |
Blocks the calling thread to wait for the condition set by pthread_con_signal(). |
pthread_cond_timedwait (pthread_cond_t *__restrict c, pthread_mutex_t *__restrict m, const struct timespec *__restrict ts) |
Blocks the calling thread to wait for the condition set by pthread_con_signal() for a period of time specified by ts. |
pthread_cond_broadcast (pthread_cond_t *c) |
Unblocks all threads that are currently blocked on the condition variable cond. |
pthread_cond_signal (pthread_cond_t *c) |
|
pthread_rwlock_init (pthread_rwlock_t *__restrict rw, const pthread_rwlockattr_t *__restrict a) |
|
pthread_rwlock_destroy (pthread_rwlock_t *rw) |
|
pthread_rwlock_rdlock (pthread_rwlock_t *rw) |
|
pthread_rwlock_tryrdlock (pthread_rwlock_t *rw) |
|
pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict rw, const struct timespec *__restrict at) |
Blocks the calling thread to lock a read-write lock for reading. |
pthread_rwlock_wrlock (pthread_rwlock_t *rw) |
|
pthread_rwlock_trywrlock (pthread_rwlock_t *rw) |
|
pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict rw, const struct timespec *__restrict at) |
Blocks the calling thread to lock a read-write lock for writing. |
pthread_rwlock_unlock (pthread_rwlock_t *rw) |
|
pthread_spin_init (pthread_spinlock_t *s, int shared) |
|
pthread_spin_destroy (pthread_spinlock_t *s) |
|
pthread_spin_lock (pthread_spinlock_t *s) |
|
pthread_spin_trylock (pthread_spinlock_t *s) |
|
pthread_spin_unlock (pthread_spinlock_t *s) |
|
pthread_barrier_init (pthread_barrier_t *__restrict b, const pthread_barrierattr_t *__restrict a, unsigned count) |
|
pthread_barrier_destroy (pthread_barrier_t *b) |
|
pthread_barrier_wait (pthread_barrier_t *b) |
|
pthread_key_create (pthread_key_t *key, void(*destructor)(void *)) |
|
pthread_key_delete (pthread_key_t key) |
|
pthread_getspecific (pthread_key_t key) |
|
pthread_setspecific (pthread_key_t key, const void *value) |
|
pthread_attr_init (pthread_attr_t *attr) |
|
pthread_attr_destroy (pthread_attr_t *attr) |
|
pthread_attr_getguardsize (const pthread_attr_t *attr, size_t *guardsize) |
|
pthread_attr_setguardsize (pthread_attr_t *attr, size_t guardsize) |
|
pthread_attr_getstacksize (const pthread_attr_t *attr, size_t *stacksize) |
|
pthread_attr_setstacksize (pthread_attr_t *attr, size_t stacksize) |
|
pthread_attr_getdetachstate (const pthread_attr_t *attr, int *detachstate) |
|
pthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate) |
|
pthread_attr_getstack (const pthread_attr_t *attr, void **stackaddr, size_t *stacksize) |
|
pthread_attr_setstack (pthread_attr_t *attr, void *stackaddr, size_t stacksize) |
|
pthread_attr_getscope (const pthread_attr_t *arrt, int *scope) |
Obtains contention scope attributes of a thread attribute object. |
pthread_attr_setscope (pthread_attr_t *arrt, int scope) |
Sets contention scope attributes for a thread attribute object. |
pthread_attr_getschedpolicy (const pthread_attr_t *attr, int *schedpolicy) |
Obtains scheduling policy attributes of a thread attribute object. |
pthread_attr_setschedpolicy (pthread_attr_t *attr, int schedpolicy) |
Sets scheduling policy attributes for a thread attribute object. |
pthread_attr_getschedparam (const pthread_attr_t *attr, struct sched_param *param) |
Obtains scheduling parameter attributes of a thread attribute object. |
pthread_attr_setschedparam (pthread_attr_t *attr, const struct sched_param *param) |
Sets scheduling parameter attributes for a thread attribute object. |
pthread_attr_getinheritsched (const pthread_attr_t *attr, int *inheritsched) |
Obtains inherit scheduler attributes of a thread attribute object. |
pthread_attr_setinheritsched (pthread_attr_t *attr, int inheritsched) |
Sets inherit scheduler attributes for a thread attribute object. |
pthread_mutexattr_destroy (pthread_mutexattr_t *attr) |
|
pthread_mutexattr_gettype (const pthread_mutexattr_t *__restrict attr, int *__restrict type) |
|
pthread_mutexattr_init (pthread_mutexattr_t *attr) |
|
pthread_mutexattr_settype (pthread_mutexattr_t *attr, int type) |
|
pthread_condattr_init (pthread_condattr_t *a) |
|
pthread_condattr_destroy (pthread_condattr_t *a) |
|
pthread_condattr_setclock (pthread_condattr_t *a, clockid_t clk) |
|
pthread_condattr_getclock (const pthread_condattr_t *__restrict a, clockid_t *__restrict clk) |
|
pthread_rwlockattr_init (pthread_rwlockattr_t *attr) |
|
pthread_rwlockattr_destroy (pthread_rwlockattr_t *attr) |
|
pthread_barrierattr_destroy (pthread_barrierattr_t *a) |
|
pthread_barrierattr_init (pthread_barrierattr_t *a) |
|
pthread_atfork (void(*prepare)(void), void(*parent)(void), void(*child)(void)) |
Registers a fork handler to be called before and after fork(). |
pthread_cleanup_push (void(*routine)(void *), void *arg) |
Pushes the routine to the top of the clean-up handler stack. |
pthread_cleanup_pop (int execute) |
Removes the routine at the top of the clean-up handler stack. |
pthread_getattr_np (pthread_t thread, pthread_attr_t *attr) |
|
pthread_setname_np (pthread_t pthread, const char *name) |