pthread.h(3)               POSIX Programmer's Manual              pthread.h(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       pthread.h -- threads

SSYYNNOOPPSSIISS
       #include <pthread.h>

DDEESSCCRRIIPPTTIIOONN
       The _<_p_t_h_r_e_a_d_._h_> header shall define the following symbolic constants:

       PTHREAD_BARRIER_SERIAL_THREAD
       PTHREAD_CANCEL_ASYNCHRONOUS
       PTHREAD_CANCEL_ENABLE
       PTHREAD_CANCEL_DEFERRED
       PTHREAD_CANCEL_DISABLE
       PTHREAD_CANCELED
       PTHREAD_CREATE_DETACHED
       PTHREAD_CREATE_JOINABLE
       PTHREAD_EXPLICIT_SCHED
       PTHREAD_INHERIT_SCHED
       PTHREAD_MUTEX_DEFAULT
       PTHREAD_MUTEX_ERRORCHECK
       PTHREAD_MUTEX_NORMAL
       PTHREAD_MUTEX_RECURSIVE
       PTHREAD_MUTEX_ROBUST
       PTHREAD_MUTEX_STALLED
       PTHREAD_ONCE_INIT
       PTHREAD_PRIO_INHERIT
       PTHREAD_PRIO_NONE
       PTHREAD_PRIO_PROTECT
       PTHREAD_PROCESS_SHARED
       PTHREAD_PROCESS_PRIVATE
       PTHREAD_SCOPE_PROCESS
       PTHREAD_SCOPE_SYSTEM

       The _<_p_t_h_r_e_a_d_._h_> header shall define the following compile-time constant
       expressions valid as initializers for the following types:

                 +---------------------------+----------------------+
                 |           NNaammee            | IInniittiiaalliizzeerr ffoorr TTyyppee |
                 +---------------------------+----------------------+
                 |PTHREAD_COND_INITIALIZER   | pptthhrreeaadd__ccoonndd__tt       |
                 |PTHREAD_MUTEX_INITIALIZER  | pptthhrreeaadd__mmuutteexx__tt      |
                 |PTHREAD_RWLOCK_INITIALIZER | pptthhrreeaadd__rrwwlloocckk__tt     |
                 +---------------------------+----------------------+
       The _<_p_t_h_r_e_a_d_._h_> header shall define the pptthhrreeaadd__aattttrr__tt,
       pptthhrreeaadd__bbaarrrriieerr__tt, pptthhrreeaadd__bbaarrrriieerraattttrr__tt, pptthhrreeaadd__ccoonndd__tt,
       pptthhrreeaadd__ccoonnddaattttrr__tt, pptthhrreeaadd__kkeeyy__tt, pptthhrreeaadd__mmuutteexx__tt,
       pptthhrreeaadd__mmuutteexxaattttrr__tt, pptthhrreeaadd__oonnccee__tt, pptthhrreeaadd__rrwwlloocckk__tt,
       pptthhrreeaadd__rrwwlloocckkaattttrr__tt, pptthhrreeaadd__ssppiinnlloocckk__tt, and pptthhrreeaadd__tt types as
       described in _<_s_y_s_/_t_y_p_e_s_._h_>.

       The following shall be declared as functions and may also be defined as
       macros. Function prototypes shall be provided.


           int   pthread_atfork(void (*)(void), void (*)(void),
                     void(*)(void));
           int   pthread_attr_destroy(pthread_attr_t *);
           int   pthread_attr_getdetachstate(const pthread_attr_t *, int *);
           int   pthread_attr_getguardsize(const pthread_attr_t *restrict,
                     size_t *restrict);
           int   pthread_attr_getinheritsched(const pthread_attr_t *restrict,
                     int *restrict);
           int   pthread_attr_getschedparam(const pthread_attr_t *restrict,
                     struct sched_param *restrict);
           int   pthread_attr_getschedpolicy(const pthread_attr_t *restrict,
                     int *restrict);
           int   pthread_attr_getscope(const pthread_attr_t *restrict,
                     int *restrict);
           int   pthread_attr_getstack(const pthread_attr_t *restrict,
                     void **restrict, size_t *restrict);
           int   pthread_attr_getstacksize(const pthread_attr_t *restrict,
                     size_t *restrict);
           int   pthread_attr_init(pthread_attr_t *);
           int   pthread_attr_setdetachstate(pthread_attr_t *, int);
           int   pthread_attr_setguardsize(pthread_attr_t *, size_t);
           int   pthread_attr_setinheritsched(pthread_attr_t *, int);
           int   pthread_attr_setschedparam(pthread_attr_t *restrict,
                     const struct sched_param *restrict);
           int   pthread_attr_setschedpolicy(pthread_attr_t *, int);
           int   pthread_attr_setscope(pthread_attr_t *, int);
           int   pthread_attr_setstack(pthread_attr_t *, void *, size_t);
           int   pthread_attr_setstacksize(pthread_attr_t *, size_t);
           int   pthread_barrier_destroy(pthread_barrier_t *);
           int   pthread_barrier_init(pthread_barrier_t *restrict,
                     const pthread_barrierattr_t *restrict, unsigned);
           int   pthread_barrier_wait(pthread_barrier_t *);
           int   pthread_barrierattr_destroy(pthread_barrierattr_t *);
           int   pthread_barrierattr_getpshared(
                     const pthread_barrierattr_t *restrict, int *restrict);
           int   pthread_barrierattr_init(pthread_barrierattr_t *);
           int   pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
           int   pthread_cancel(pthread_t);
           int   pthread_cond_broadcast(pthread_cond_t *);
           int   pthread_cond_destroy(pthread_cond_t *);
           int   pthread_cond_init(pthread_cond_t *restrict,
                     const pthread_condattr_t *restrict);
           int   pthread_cond_signal(pthread_cond_t *);
           int   pthread_cond_timedwait(pthread_cond_t *restrict,
                     pthread_mutex_t *restrict, const struct timespec *restrict);
           int   pthread_cond_wait(pthread_cond_t *restrict,
                     pthread_mutex_t *restrict);
           int   pthread_condattr_destroy(pthread_condattr_t *);
           int   pthread_condattr_getclock(const pthread_condattr_t *restrict,
                     clockid_t *restrict);
           int   pthread_condattr_getpshared(const pthread_condattr_t *restrict,
                     int *restrict);
           int   pthread_condattr_init(pthread_condattr_t *);
           int   pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
           int   pthread_condattr_setpshared(pthread_condattr_t *, int);
           int   pthread_create(pthread_t *restrict, const pthread_attr_t *restrict,
                     void *(*)(void*), void *restrict);
           int   pthread_detach(pthread_t);
           int   pthread_equal(pthread_t, pthread_t);
           void  pthread_exit(void *);
           int   pthread_getconcurrency(void);
           int   pthread_getcpuclockid(pthread_t, clockid_t *);
           int   pthread_getschedparam(pthread_t, int *restrict,
                     struct sched_param *restrict);
           void *pthread_getspecific(pthread_key_t);
           int   pthread_join(pthread_t, void **);
           int   pthread_key_create(pthread_key_t *, void (*)(void*));
           int   pthread_key_delete(pthread_key_t);
           int   pthread_mutex_consistent(pthread_mutex_t *);
           int   pthread_mutex_destroy(pthread_mutex_t *);
           int   pthread_mutex_getprioceiling(const pthread_mutex_t *restrict,
                     int *restrict);
           int   pthread_mutex_init(pthread_mutex_t *restrict,
                     const pthread_mutexattr_t *restrict);
           int   pthread_mutex_lock(pthread_mutex_t *);
           int   pthread_mutex_setprioceiling(pthread_mutex_t *restrict, int,
                     int *restrict);
           int   pthread_mutex_timedlock(pthread_mutex_t *restrict,
                     const struct timespec *restrict);
           int   pthread_mutex_trylock(pthread_mutex_t *);
           int   pthread_mutex_unlock(pthread_mutex_t *);
           int   pthread_mutexattr_destroy(pthread_mutexattr_t *);
           int   pthread_mutexattr_getprioceiling(
                     const pthread_mutexattr_t *restrict, int *restrict);
           int   pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict,
                     int *restrict);
           int   pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict,
                     int *restrict);
           int   pthread_mutexattr_getrobust(const pthread_mutexattr_t *restrict,
                     int *restrict);
           int   pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict,
                     int *restrict);
           int   pthread_mutexattr_init(pthread_mutexattr_t *);
           int   pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
           int   pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
           int   pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
           int   pthread_mutexattr_setrobust(pthread_mutexattr_t *, int);
           int   pthread_mutexattr_settype(pthread_mutexattr_t *, int);
           int   pthread_once(pthread_once_t *, void (*)(void));
           int   pthread_rwlock_destroy(pthread_rwlock_t *);
           int   pthread_rwlock_init(pthread_rwlock_t *restrict,
                     const pthread_rwlockattr_t *restrict);
           int   pthread_rwlock_rdlock(pthread_rwlock_t *);
           int   pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict,
                     const struct timespec *restrict);
           int   pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict,
                     const struct timespec *restrict);
           int   pthread_rwlock_tryrdlock(pthread_rwlock_t *);
           int   pthread_rwlock_trywrlock(pthread_rwlock_t *);
           int   pthread_rwlock_unlock(pthread_rwlock_t *);
           int   pthread_rwlock_wrlock(pthread_rwlock_t *);
           int   pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
           int   pthread_rwlockattr_getpshared(
                     const pthread_rwlockattr_t *restrict, int *restrict);
           int   pthread_rwlockattr_init(pthread_rwlockattr_t *);
           int   pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
           pthread_t
                 pthread_self(void);
           int   pthread_setcancelstate(int, int *);
           int   pthread_setcanceltype(int, int *);
           int   pthread_setconcurrency(int);
           int   pthread_setschedparam(pthread_t, int,
                     const struct sched_param *);
           int   pthread_setschedprio(pthread_t, int);
           int   pthread_setspecific(pthread_key_t, const void *);
           int   pthread_spin_destroy(pthread_spinlock_t *);
           int   pthread_spin_init(pthread_spinlock_t *, int);
           int   pthread_spin_lock(pthread_spinlock_t *);
           int   pthread_spin_trylock(pthread_spinlock_t *);
           int   pthread_spin_unlock(pthread_spinlock_t *);
           void  pthread_testcancel(void);

       The following may be declared as functions, or defined as macros, or
       both.  If functions are declared, function prototypes shall be
       provided.

              _p_t_h_r_e_a_d___c_l_e_a_n_u_p___p_o_p() _p_t_h_r_e_a_d___c_l_e_a_n_u_p___p_u_s_h()

       Inclusion of the _<_p_t_h_r_e_a_d_._h_> header shall make symbols defined in the
       headers _<_s_c_h_e_d_._h_> and _<_t_i_m_e_._h_> visible.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       None.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       <<sscchheedd..hh>>, <<ssyyss__ttyyppeess..hh>>, <<ttiimmee..hh>>

       The System Interfaces volume of POSIX.1-2017, _p_t_h_r_e_a_d___a_t_f_o_r_k(),
       _p_t_h_r_e_a_d___a_t_t_r___d_e_s_t_r_o_y(), _p_t_h_r_e_a_d___a_t_t_r___g_e_t_d_e_t_a_c_h_s_t_a_t_e(),
       _p_t_h_r_e_a_d___a_t_t_r___g_e_t_g_u_a_r_d_s_i_z_e(), _p_t_h_r_e_a_d___a_t_t_r___g_e_t_i_n_h_e_r_i_t_s_c_h_e_d(),
       _p_t_h_r_e_a_d___a_t_t_r___g_e_t_s_c_h_e_d_p_a_r_a_m(), _p_t_h_r_e_a_d___a_t_t_r___g_e_t_s_c_h_e_d_p_o_l_i_c_y(),
       _p_t_h_r_e_a_d___a_t_t_r___g_e_t_s_c_o_p_e(), _p_t_h_r_e_a_d___a_t_t_r___g_e_t_s_t_a_c_k(),
       _p_t_h_r_e_a_d___a_t_t_r___g_e_t_s_t_a_c_k_s_i_z_e(), _p_t_h_r_e_a_d___b_a_r_r_i_e_r___d_e_s_t_r_o_y(),
       _p_t_h_r_e_a_d___b_a_r_r_i_e_r___w_a_i_t(), _p_t_h_r_e_a_d___b_a_r_r_i_e_r_a_t_t_r___d_e_s_t_r_o_y(),
       _p_t_h_r_e_a_d___b_a_r_r_i_e_r_a_t_t_r___g_e_t_p_s_h_a_r_e_d(), _p_t_h_r_e_a_d___c_a_n_c_e_l(),
       _p_t_h_r_e_a_d___c_l_e_a_n_u_p___p_o_p(), _p_t_h_r_e_a_d___c_o_n_d___b_r_o_a_d_c_a_s_t(),
       _p_t_h_r_e_a_d___c_o_n_d___d_e_s_t_r_o_y(), _p_t_h_r_e_a_d___c_o_n_d___t_i_m_e_d_w_a_i_t(),
       _p_t_h_r_e_a_d___c_o_n_d_a_t_t_r___d_e_s_t_r_o_y(), _p_t_h_r_e_a_d___c_o_n_d_a_t_t_r___g_e_t_c_l_o_c_k(),
       _p_t_h_r_e_a_d___c_o_n_d_a_t_t_r___g_e_t_p_s_h_a_r_e_d(), _p_t_h_r_e_a_d___c_r_e_a_t_e(), _p_t_h_r_e_a_d___d_e_t_a_c_h(),
       _p_t_h_r_e_a_d___e_q_u_a_l(), _p_t_h_r_e_a_d___e_x_i_t(), _p_t_h_r_e_a_d___g_e_t_c_o_n_c_u_r_r_e_n_c_y(),
       _p_t_h_r_e_a_d___g_e_t_c_p_u_c_l_o_c_k_i_d(), _p_t_h_r_e_a_d___g_e_t_s_c_h_e_d_p_a_r_a_m(),
       _p_t_h_r_e_a_d___g_e_t_s_p_e_c_i_f_i_c(), _p_t_h_r_e_a_d___j_o_i_n(), _p_t_h_r_e_a_d___k_e_y___c_r_e_a_t_e(),
       _p_t_h_r_e_a_d___k_e_y___d_e_l_e_t_e(), _p_t_h_r_e_a_d___m_u_t_e_x___c_o_n_s_i_s_t_e_n_t(),
       _p_t_h_r_e_a_d___m_u_t_e_x___d_e_s_t_r_o_y(), _p_t_h_r_e_a_d___m_u_t_e_x___g_e_t_p_r_i_o_c_e_i_l_i_n_g(),
       _p_t_h_r_e_a_d___m_u_t_e_x___l_o_c_k(), _p_t_h_r_e_a_d___m_u_t_e_x___t_i_m_e_d_l_o_c_k(),
       _p_t_h_r_e_a_d___m_u_t_e_x_a_t_t_r___d_e_s_t_r_o_y(), _p_t_h_r_e_a_d___m_u_t_e_x_a_t_t_r___g_e_t_p_r_i_o_c_e_i_l_i_n_g(),
       _p_t_h_r_e_a_d___m_u_t_e_x_a_t_t_r___g_e_t_p_r_o_t_o_c_o_l(), _p_t_h_r_e_a_d___m_u_t_e_x_a_t_t_r___g_e_t_p_s_h_a_r_e_d(),
       _p_t_h_r_e_a_d___m_u_t_e_x_a_t_t_r___g_e_t_r_o_b_u_s_t(), _p_t_h_r_e_a_d___m_u_t_e_x_a_t_t_r___g_e_t_t_y_p_e(),
       _p_t_h_r_e_a_d___o_n_c_e(), _p_t_h_r_e_a_d___r_w_l_o_c_k___d_e_s_t_r_o_y(), _p_t_h_r_e_a_d___r_w_l_o_c_k___r_d_l_o_c_k(),
       _p_t_h_r_e_a_d___r_w_l_o_c_k___t_i_m_e_d_r_d_l_o_c_k(), _p_t_h_r_e_a_d___r_w_l_o_c_k___t_i_m_e_d_w_r_l_o_c_k(),
       _p_t_h_r_e_a_d___r_w_l_o_c_k___t_r_y_w_r_l_o_c_k(), _p_t_h_r_e_a_d___r_w_l_o_c_k___u_n_l_o_c_k(),
       _p_t_h_r_e_a_d___r_w_l_o_c_k_a_t_t_r___d_e_s_t_r_o_y(), _p_t_h_r_e_a_d___r_w_l_o_c_k_a_t_t_r___g_e_t_p_s_h_a_r_e_d(),
       _p_t_h_r_e_a_d___s_e_l_f(), _p_t_h_r_e_a_d___s_e_t_c_a_n_c_e_l_s_t_a_t_e(), _p_t_h_r_e_a_d___s_e_t_s_c_h_e_d_p_r_i_o(),
       _p_t_h_r_e_a_d___s_p_i_n___d_e_s_t_r_o_y(), _p_t_h_r_e_a_d___s_p_i_n___l_o_c_k(), _p_t_h_r_e_a_d___s_p_i_n___u_n_l_o_c_k()

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                         pthread.h(3)
