1<pthread.h>(0P)            POSIX Programmer's Manual           <pthread.h>(0P)
2
3
4

NAME

6       pthread.h - threads
7

SYNOPSIS

9       #include <pthread.h>
10

DESCRIPTION

12       The <pthread.h> header shall define the following symbols:
13
14       PTHREAD_BARRIER_SERIAL_THREAD
15
16       PTHREAD_CANCEL_ASYNCHRONOUS
17       PTHREAD_CANCEL_ENABLE
18       PTHREAD_CANCEL_DEFERRED
19       PTHREAD_CANCEL_DISABLE
20       PTHREAD_CANCELED
21       PTHREAD_COND_INITIALIZER
22       PTHREAD_CREATE_DETACHED
23       PTHREAD_CREATE_JOINABLE
24       PTHREAD_EXPLICIT_SCHED
25       PTHREAD_INHERIT_SCHED
26
27       PTHREAD_MUTEX_DEFAULT
28       PTHREAD_MUTEX_ERRORCHECK
29
30       PTHREAD_MUTEX_INITIALIZER
31
32       PTHREAD_MUTEX_NORMAL
33       PTHREAD_MUTEX_RECURSIVE
34
35       PTHREAD_ONCE_INIT
36
37       PTHREAD_PRIO_INHERIT
38
39
40       PTHREAD_PRIO_NONE
41
42
43       PTHREAD_PRIO_PROTECT
44
45       PTHREAD_PROCESS_SHARED
46       PTHREAD_PROCESS_PRIVATE
47
48       PTHREAD_SCOPE_PROCESS
49       PTHREAD_SCOPE_SYSTEM
50
51
52       The following types shall be defined as described in <sys/types.h> :
53
54       pthread_attr_t
55
56       pthread_barrier_t
57       pthread_barrierattr_t
58
59       pthread_cond_t
60       pthread_condattr_t
61       pthread_key_t
62       pthread_mutex_t
63       pthread_mutexattr_t
64       pthread_once_t
65       pthread_rwlock_t
66       pthread_rwlockattr_t
67
68       pthread_spinlock_t
69
70       pthread_t
71
72       The following shall be declared as functions and may also be defined as
73       macros. Function prototypes shall be provided.
74
75
76              int   pthread_atfork(void (*)(void), void (*)(void),
77                        void(*)(void));
78              int   pthread_attr_destroy(pthread_attr_t *);
79              int   pthread_attr_getdetachstate(const pthread_attr_t *, int *);
80
81              int   pthread_attr_getguardsize(const pthread_attr_t *restrict,
82                        size_t *restrict);
83
84
85              int   pthread_attr_getinheritsched(const pthread_attr_t *restrict,
86                        int *restrict);
87
88              int   pthread_attr_getschedparam(const pthread_attr_t *restrict,
89                        struct sched_param *restrict);
90
91              int   pthread_attr_getschedpolicy(const pthread_attr_t *restrict,
92                        int *restrict);
93
94
95              int   pthread_attr_getscope(const pthread_attr_t *restrict,
96                        int *restrict);
97
98
99              int   pthread_attr_getstack(const pthread_attr_t *restrict,
100                        void **restrict, size_t *restrict);
101
102
103              int   pthread_attr_getstackaddr(const pthread_attr_t *restrict,
104                        void **restrict);
105
106
107              int   pthread_attr_getstacksize(const pthread_attr_t *restrict,
108                        size_t *restrict);
109
110              int   pthread_attr_init(pthread_attr_t *);
111              int   pthread_attr_setdetachstate(pthread_attr_t *, int);
112
113              int   pthread_attr_setguardsize(pthread_attr_t *, size_t);
114
115
116              int   pthread_attr_setinheritsched(pthread_attr_t *, int);
117
118              int   pthread_attr_setschedparam(pthread_attr_t *restrict,
119                        const struct sched_param *restrict);
120
121              int   pthread_attr_setschedpolicy(pthread_attr_t *, int);
122              int   pthread_attr_setscope(pthread_attr_t *, int);
123
124
125              int   pthread_attr_setstack(pthread_attr_t *, void *, size_t);
126
127
128              int   pthread_attr_setstackaddr(pthread_attr_t *, void *);
129
130
131              int   pthread_attr_setstacksize(pthread_attr_t *, size_t);
132
133
134              int   pthread_barrier_destroy(pthread_barrier_t *);
135              int   pthread_barrier_init(pthread_barrier_t *restrict,
136                        const pthread_barrierattr_t *restrict, unsigned);
137              int   pthread_barrier_wait(pthread_barrier_t *);
138              int   pthread_barrierattr_destroy(pthread_barrierattr_t *);
139
140
141              int   pthread_barrierattr_getpshared(
142                        const pthread_barrierattr_t *restrict, int *restrict);
143
144
145              int   pthread_barrierattr_init(pthread_barrierattr_t *);
146
147
148              int   pthread_barrierattr_setpshared(pthread_barrierattr_t *, int);
149
150              int   pthread_cancel(pthread_t);
151              void  pthread_cleanup_push(void (*)(void *), void *);
152              void  pthread_cleanup_pop(int);
153              int   pthread_cond_broadcast(pthread_cond_t *);
154              int   pthread_cond_destroy(pthread_cond_t *);
155              int   pthread_cond_init(pthread_cond_t *restrict,
156                        const pthread_condattr_t *restrict);
157              int   pthread_cond_signal(pthread_cond_t *);
158              int   pthread_cond_timedwait(pthread_cond_t *restrict,
159                        pthread_mutex_t *restrict, const struct timespec *restrict);
160              int   pthread_cond_wait(pthread_cond_t *restrict,
161                        pthread_mutex_t *restrict);
162              int   pthread_condattr_destroy(pthread_condattr_t *);
163
164              int   pthread_condattr_getclock(const pthread_condattr_t *restrict,
165                        clockid_t *restrict);
166
167
168              int   pthread_condattr_getpshared(const pthread_condattr_t *restrict,
169                        int *restrict);
170
171              int   pthread_condattr_init(pthread_condattr_t *);
172
173              int   pthread_condattr_setclock(pthread_condattr_t *, clockid_t);
174
175
176              int   pthread_condattr_setpshared(pthread_condattr_t *, int);
177
178              int   pthread_create(pthread_t *restrict, const pthread_attr_t *restrict,
179                        void *(*)(void *), void *restrict);
180              int   pthread_detach(pthread_t);
181              int   pthread_equal(pthread_t, pthread_t);
182              void  pthread_exit(void *);
183
184              int   pthread_getconcurrency(void);
185
186
187              int   pthread_getcpuclockid(pthread_t, clockid_t *);
188
189
190              int   pthread_getschedparam(pthread_t, int *restrict,
191                        struct sched_param *restrict);
192
193              void *pthread_getspecific(pthread_key_t);
194              int   pthread_join(pthread_t, void **);
195              int   pthread_key_create(pthread_key_t *, void (*)(void *));
196              int   pthread_key_delete(pthread_key_t);
197              int   pthread_mutex_destroy(pthread_mutex_t *);
198
199              int   pthread_mutex_getprioceiling(const pthread_mutex_t *restrict,
200                        int *restrict);
201
202              int   pthread_mutex_init(pthread_mutex_t *restrict,
203                        const pthread_mutexattr_t *restrict);
204              int   pthread_mutex_lock(pthread_mutex_t *);
205
206              int   pthread_mutex_setprioceiling(pthread_mutex_t *restrict, int,
207                        int *restrict);
208
209
210              int   pthread_mutex_timedlock(pthread_mutex_t *,
211                        const struct timespec *);
212
213              int   pthread_mutex_trylock(pthread_mutex_t *);
214              int   pthread_mutex_unlock(pthread_mutex_t *);
215              int   pthread_mutexattr_destroy(pthread_mutexattr_t *);
216
217              int   pthread_mutexattr_getprioceiling(
218                        const pthread_mutexattr_t *restrict, int *restrict);
219
220
221              int   pthread_mutexattr_getprotocol(const pthread_mutexattr_t *restrict,
222                        int *restrict);
223
224
225              int   pthread_mutexattr_getpshared(const pthread_mutexattr_t *restrict,
226                        int *restrict);
227
228
229              int   pthread_mutexattr_gettype(const pthread_mutexattr_t *restrict,
230                        int *restrict);
231
232              int   pthread_mutexattr_init(pthread_mutexattr_t *);
233
234              int   pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
235
236
237              int   pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
238
239
240              int   pthread_mutexattr_setpshared(pthread_mutexattr_t *, int);
241
242
243              int   pthread_mutexattr_settype(pthread_mutexattr_t *, int);
244
245              int   pthread_once(pthread_once_t *, void (*)(void));
246              int   pthread_rwlock_destroy(pthread_rwlock_t *);
247              int   pthread_rwlock_init(pthread_rwlock_t *restrict,
248                        const pthread_rwlockattr_t *restrict);
249              int   pthread_rwlock_rdlock(pthread_rwlock_t *);
250
251              int   pthread_rwlock_timedrdlock(pthread_rwlock_t *restrict,
252                        const struct timespec *restrict);
253              int   pthread_rwlock_timedwrlock(pthread_rwlock_t *restrict,
254                        const struct timespec *restrict);
255
256              int   pthread_rwlock_tryrdlock(pthread_rwlock_t *);
257              int   pthread_rwlock_trywrlock(pthread_rwlock_t *);
258              int   pthread_rwlock_unlock(pthread_rwlock_t *);
259              int   pthread_rwlock_wrlock(pthread_rwlock_t *);
260              int   pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
261
262              int   pthread_rwlockattr_getpshared(
263                        const pthread_rwlockattr_t *restrict, int *restrict);
264
265              int   pthread_rwlockattr_init(pthread_rwlockattr_t *);
266
267              int   pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int);
268
269              pthread_t
270                    pthread_self(void);
271              int   pthread_setcancelstate(int, int *);
272              int   pthread_setcanceltype(int, int *);
273
274              int   pthread_setconcurrency(int);
275
276
277              int   pthread_setschedparam(pthread_t, int,
278                        const struct sched_param *);
279
280
281              int   pthread_setschedprio(pthread_t, int);
282
283              int   pthread_setspecific(pthread_key_t, const void *);
284
285              int   pthread_spin_destroy(pthread_spinlock_t *);
286              int   pthread_spin_init(pthread_spinlock_t *, int);
287              int   pthread_spin_lock(pthread_spinlock_t *);
288              int   pthread_spin_trylock(pthread_spinlock_t *);
289              int   pthread_spin_unlock(pthread_spinlock_t *);
290
291              void  pthread_testcancel(void);
292
293       Inclusion of the <pthread.h> header shall make symbols defined  in  the
294       headers <sched.h> and <time.h> visible.
295
296       The following sections are informative.
297

APPLICATION USAGE

299       None.
300

RATIONALE

302       None.
303

FUTURE DIRECTIONS

305       None.
306

SEE ALSO

308       <sched.h>,  <sys/types.h>,  <time.h>,  the  System Interfaces volume of
309       IEEE Std 1003.1-2001, pthread_attr_getguardsize(), pthread_attr_init(),
310       pthread_attr_setscope(),     pthread_barrier_destroy(),    pthread_bar‐
311       rier_init(),   pthread_barrier_wait(),   pthread_barrierattr_destroy(),
312       pthread_barrierattr_getpshared(),           pthread_barrierattr_init(),
313       pthread_barrierattr_setpshared(),                     pthread_cancel(),
314       pthread_cleanup_pop(),    pthread_cond_init(),   pthread_cond_signal(),
315       pthread_cond_wait(),     pthread_condattr_getclock(),      pthread_con‐
316       dattr_init(),       pthread_condattr_setclock(),      pthread_create(),
317       pthread_detach(), pthread_equal(),  pthread_exit(),  pthread_getconcur‐
318       rency(),        pthread_getcpuclockid(),       pthread_getschedparam(),
319       pthread_join(),       pthread_key_create(),       pthread_key_delete(),
320       pthread_mutex_init(),  pthread_mutex_lock(), pthread_mutex_setprioceil‐
321       ing(),       pthread_mutex_timedlock(),       pthread_mutexattr_init(),
322       pthread_mutexattr_gettype(),           pthread_mutexattr_setprotocol(),
323       pthread_once(),    pthread_rwlock_destroy(),     pthread_rwlock_init(),
324       pthread_rwlock_rdlock(),                  pthread_rwlock_timedrdlock(),
325       pthread_rwlock_timedwrlock(),               pthread_rwlock_tryrdlock(),
326       pthread_rwlock_trywrlock(),                    pthread_rwlock_unlock(),
327       pthread_rwlock_wrlock(), pthread_rwlockattr_destroy(),  pthread_rwlock‐
328       attr_getpshared(),  pthread_rwlockattr_init(), pthread_rwlockattr_setp‐
329       shared(),  pthread_self(),  pthread_setcancelstate(),   pthread_setspe‐
330       cific(),          pthread_spin_destroy(),          pthread_spin_init(),
331       pthread_spin_lock(), pthread_spin_trylock(), pthread_spin_unlock()
332
334       Portions of this text are reprinted and reproduced in  electronic  form
335       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
336       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
337       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
338       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
339       event of any discrepancy between this version and the original IEEE and
340       The Open Group Standard, the original IEEE and The Open Group  Standard
341       is  the  referee document. The original Standard can be obtained online
342       at http://www.opengroup.org/unix/online.html .
343
344
345
346IEEE/The Open Group                  2003                      <pthread.h>(0P)
Impressum