]> git.saurik.com Git - apple/libc.git/blame - pthreads/pthread.h
Libc-825.40.1.tar.gz
[apple/libc.git] / pthreads / pthread.h
CommitLineData
9385eb3d
A
1/*
2 * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
224c7076 5 *
9385eb3d
A
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
224c7076 12 *
9385eb3d
A
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
224c7076 20 *
9385eb3d
A
21 * @APPLE_LICENSE_HEADER_END@
22 */
e9ce8d39 23/*
224c7076
A
24 * Copyright 1996 1995 by Open Software Foundation, Inc. 1997 1996 1995 1994 1993 1992 1991
25 * All Rights Reserved
26 *
27 * Permission to use, copy, modify, and distribute this software and
28 * its documentation for any purpose and without fee is hereby granted,
29 * provided that the above copyright notice appears in all copies and
30 * that both the copyright notice and this permission notice appear in
31 * supporting documentation.
32 *
33 * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
34 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
35 * FOR A PARTICULAR PURPOSE.
36 *
37 * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
38 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
39 * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
40 * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
41 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
42 *
e9ce8d39
A
43 */
44/*
45 * MkLinux
46 */
47
48/*
49 * POSIX Threads - IEEE 1003.1c
50 */
51
224c7076
A
52#ifndef _PTHREAD_H
53#define _PTHREAD_H
e9ce8d39 54
3d9156a7 55#include <_types.h>
e9ce8d39
A
56#ifndef __POSIX_LIB__
57#include <pthread_impl.h>
58#endif
e9ce8d39
A
59#include <sched.h>
60#include <time.h>
5b2abdfb 61
3d9156a7
A
62#ifndef _PTHREAD_ATTR_T
63#define _PTHREAD_ATTR_T
64typedef __darwin_pthread_attr_t pthread_attr_t;
65#endif
66
67#ifndef _PTHREAD_COND_T
68#define _PTHREAD_COND_T
69typedef __darwin_pthread_cond_t pthread_cond_t;
70#endif
71
72#ifndef _PTHREAD_CONDATTR_T
73#define _PTHREAD_CONDATTR_T
74typedef __darwin_pthread_condattr_t pthread_condattr_t;
75#endif
76
77#ifndef _PTHREAD_KEY_T
78#define _PTHREAD_KEY_T
79typedef __darwin_pthread_key_t pthread_key_t;
80#endif
81
82#ifndef _PTHREAD_MUTEX_T
83#define _PTHREAD_MUTEX_T
84typedef __darwin_pthread_mutex_t pthread_mutex_t;
85#endif
86
87#ifndef _PTHREAD_MUTEXATTR_T
88#define _PTHREAD_MUTEXATTR_T
89typedef __darwin_pthread_mutexattr_t pthread_mutexattr_t;
90#endif
91
92#ifndef _PTHREAD_ONCE_T
93#define _PTHREAD_ONCE_T
94typedef __darwin_pthread_once_t pthread_once_t;
95#endif
96
97#ifndef _PTHREAD_RWLOCK_T
98#define _PTHREAD_RWLOCK_T
99typedef __darwin_pthread_rwlock_t pthread_rwlock_t;
100#endif
101
102#ifndef _PTHREAD_RWLOCKATTR_T
103#define _PTHREAD_RWLOCKATTR_T
104typedef __darwin_pthread_rwlockattr_t pthread_rwlockattr_t;
105#endif
106
107#ifndef _PTHREAD_T
108#define _PTHREAD_T
109typedef __darwin_pthread_t pthread_t;
110#endif
111
224c7076 112#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
3d9156a7
A
113
114#ifndef _MACH_PORT_T
115#define _MACH_PORT_T
116typedef __darwin_mach_port_t mach_port_t;
117#endif
118
119#ifndef _SIGSET_T
120#define _SIGSET_T
121typedef __darwin_sigset_t sigset_t;
122#endif
123
224c7076 124#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */
e9ce8d39
A
125
126/*
127 * These symbols indicate which [optional] features are available
128 * They can be tested at compile time via '#ifdef XXX'
129 * The way to check for pthreads is like so:
224c7076 130
e9ce8d39
A
131 * #include <unistd.h>
132 * #ifdef _POSIX_THREADS
133 * #include <pthread.h>
134 * #endif
135
136 */
137
138/* These will be moved to unistd.h */
139
e9ce8d39
A
140/*
141 * Note: These data structures are meant to be opaque. Only enough
142 * structure is exposed to support initializers.
143 * All of the typedefs will be moved to <sys/types.h>
144 */
145
146#include <sys/cdefs.h>
1f2f436a 147#include <Availability.h>
e9ce8d39
A
148
149__BEGIN_DECLS
150/*
151 * Threads
152 */
153
154
155/*
156 * Cancel cleanup handler management. Note, since these are implemented as macros,
157 * they *MUST* occur in matched pairs!
158 */
159
160#define pthread_cleanup_push(func, val) \
161 { \
3d9156a7 162 struct __darwin_pthread_handler_rec __handler; \
e9ce8d39 163 pthread_t __self = pthread_self(); \
3d9156a7
A
164 __handler.__routine = func; \
165 __handler.__arg = val; \
166 __handler.__next = __self->__cleanup_stack; \
167 __self->__cleanup_stack = &__handler;
e9ce8d39
A
168
169#define pthread_cleanup_pop(execute) \
170 /* Note: 'handler' must be in this same lexical context! */ \
3d9156a7
A
171 __self->__cleanup_stack = __handler.__next; \
172 if (execute) (__handler.__routine)(__handler.__arg); \
e9ce8d39 173 }
3d9156a7 174
e9ce8d39
A
175/*
176 * Thread attributes
177 */
178
179#define PTHREAD_CREATE_JOINABLE 1
180#define PTHREAD_CREATE_DETACHED 2
181
182#define PTHREAD_INHERIT_SCHED 1
183#define PTHREAD_EXPLICIT_SCHED 2
184
185#define PTHREAD_CANCEL_ENABLE 0x01 /* Cancel takes place at next cancellation point */
186#define PTHREAD_CANCEL_DISABLE 0x00 /* Cancel postponed */
187#define PTHREAD_CANCEL_DEFERRED 0x02 /* Cancel waits until cancellation point */
188#define PTHREAD_CANCEL_ASYNCHRONOUS 0x00 /* Cancel occurs immediately */
189
3d9156a7
A
190/* Value returned from pthread_join() when a thread is canceled */
191#define PTHREAD_CANCELED ((void *) 1)
192
e9ce8d39
A
193/* We only support PTHREAD_SCOPE_SYSTEM */
194#define PTHREAD_SCOPE_SYSTEM 1
195#define PTHREAD_SCOPE_PROCESS 2
196
5b2abdfb
A
197/* We only support PTHREAD_PROCESS_PRIVATE */
198#define PTHREAD_PROCESS_SHARED 1
199#define PTHREAD_PROCESS_PRIVATE 2
200
e9ce8d39 201/*
5b2abdfb 202 * Mutex protocol attributes
e9ce8d39
A
203 */
204#define PTHREAD_PRIO_NONE 0
205#define PTHREAD_PRIO_INHERIT 1
206#define PTHREAD_PRIO_PROTECT 2
207
5b2abdfb
A
208/*
209 * Mutex type attributes
210 */
211#define PTHREAD_MUTEX_NORMAL 0
224c7076 212#define PTHREAD_MUTEX_ERRORCHECK 1
5b2abdfb
A
213#define PTHREAD_MUTEX_RECURSIVE 2
214#define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
224c7076
A
215/*
216 * RWLock variables
217 */
218
219#define PTHREAD_RWLOCK_INITIALIZER {_PTHREAD_RWLOCK_SIG_init, {0}}
e9ce8d39
A
220/*
221 * Mutex variables
222 */
223
9385eb3d 224#define PTHREAD_MUTEX_INITIALIZER {_PTHREAD_MUTEX_SIG_init, {0}}
e9ce8d39 225
1f2f436a
A
226#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
227#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER {_PTHREAD_ERRORCHECK_MUTEX_SIG_init, {0}}
228#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER {_PTHREAD_RECURSIVE_MUTEX_SIG_init, {0}}
229#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */
230
e9ce8d39
A
231/*
232 * Condition variable attributes
233 */
234
235/*
236 * Condition variables
237 */
238
9385eb3d 239#define PTHREAD_COND_INITIALIZER {_PTHREAD_COND_SIG_init, {0}}
e9ce8d39
A
240
241/*
242 * Initialization control (once) variables
243 */
244
9385eb3d 245#define PTHREAD_ONCE_INIT {_PTHREAD_ONCE_SIG_init, {0}}
e9ce8d39 246
e9ce8d39
A
247/*
248 * Prototypes for all PTHREAD interfaces
249 */
224c7076
A
250int pthread_atfork(void (*)(void), void (*)(void),
251 void (*)(void));
252int pthread_attr_destroy(pthread_attr_t *);
253int pthread_attr_getdetachstate(const pthread_attr_t *,
254 int *);
255int pthread_attr_getguardsize(const pthread_attr_t * __restrict,
256 size_t * __restrict);
257int pthread_attr_getinheritsched(const pthread_attr_t * __restrict,
258 int * __restrict);
259int pthread_attr_getschedparam(const pthread_attr_t * __restrict,
260 struct sched_param * __restrict);
261int pthread_attr_getschedpolicy(const pthread_attr_t * __restrict,
262 int * __restrict);
263int pthread_attr_getscope(const pthread_attr_t * __restrict, int * __restrict);
264int pthread_attr_getstack(const pthread_attr_t * __restrict,
265 void ** __restrict, size_t * __restrict);
266int pthread_attr_getstackaddr(const pthread_attr_t * __restrict,
267 void ** __restrict);
268int pthread_attr_getstacksize(const pthread_attr_t * __restrict,
269 size_t * __restrict);
270int pthread_attr_init(pthread_attr_t *);
271int pthread_attr_setdetachstate(pthread_attr_t *,
272 int );
273int pthread_attr_setguardsize(pthread_attr_t *, size_t );
274int pthread_attr_setinheritsched(pthread_attr_t *,
275 int );
276int pthread_attr_setschedparam(pthread_attr_t * __restrict,
277 const struct sched_param * __restrict);
278int pthread_attr_setschedpolicy(pthread_attr_t *,
279 int );
3d9156a7 280int pthread_attr_setscope(pthread_attr_t *, int);
224c7076
A
281int pthread_attr_setstack(pthread_attr_t *,
282 void *, size_t );
283int pthread_attr_setstackaddr(pthread_attr_t *,
284 void *);
285int pthread_attr_setstacksize(pthread_attr_t *, size_t );
286int pthread_cancel(pthread_t ) __DARWIN_ALIAS(pthread_cancel);
287
288int pthread_cond_broadcast(pthread_cond_t *);
289int pthread_cond_destroy(pthread_cond_t *);
290//Begin-Libc
291#ifndef LIBC_ALIAS_PTHREAD_COND_INIT
292//End-Libc
293int pthread_cond_init(pthread_cond_t * __restrict,
294 const pthread_condattr_t * __restrict) __DARWIN_ALIAS(pthread_cond_init);
295//Begin-Libc
296#else /* LIBC_ALIAS_PTHREAD_COND_INIT */
297int pthread_cond_init(pthread_cond_t * __restrict,
298 const pthread_condattr_t * __restrict) LIBC_ALIAS(pthread_cond_init);
299#endif /* !LIBC_ALIAS_PTHREAD_COND_INIT */
300//End-Libc
301int pthread_cond_signal(pthread_cond_t *);
302//Begin-Libc
303#ifndef LIBC_ALIAS_PTHREAD_COND_TIMEDWAIT
304//End-Libc
305int pthread_cond_timedwait(pthread_cond_t * __restrict,
306 pthread_mutex_t * __restrict,
307 const struct timespec * __restrict) __DARWIN_ALIAS_C(pthread_cond_timedwait);
308//Begin-Libc
309#else /* LIBC_ALIAS_PTHREAD_COND_TIMEDWAIT */
310int pthread_cond_timedwait(pthread_cond_t * __restrict,
311 pthread_mutex_t * __restrict,
312 const struct timespec * __restrict) LIBC_ALIAS_C(pthread_cond_timedwait);
313#endif /* !LIBC_ALIAS_PTHREAD_COND_TIMEDWAIT */
314//End-Libc
315//Begin-Libc
316#ifndef LIBC_ALIAS_PTHREAD_COND_WAIT
317//End-Libc
318int pthread_cond_wait(pthread_cond_t * __restrict,
319 pthread_mutex_t * __restrict) __DARWIN_ALIAS_C(pthread_cond_wait);
320//Begin-Libc
321#else /* LIBC_ALIAS_PTHREAD_COND_WAIT */
322int pthread_cond_wait(pthread_cond_t * __restrict,
323 pthread_mutex_t * __restrict) LIBC_ALIAS_C(pthread_cond_wait);
324#endif /* !LIBC_ALIAS_PTHREAD_COND_WAIT */
325//End-Libc
326int pthread_condattr_destroy(pthread_condattr_t *);
327int pthread_condattr_init(pthread_condattr_t *);
328int pthread_condattr_getpshared(const pthread_condattr_t * __restrict,
329 int * __restrict);
330int pthread_condattr_setpshared(pthread_condattr_t *,
331 int );
332int pthread_create(pthread_t * __restrict,
333 const pthread_attr_t * __restrict,
334 void *(*)(void *),
335 void * __restrict);
336int pthread_detach(pthread_t );
337int pthread_equal(pthread_t ,
338 pthread_t );
339void pthread_exit(void *) __dead2;
3d9156a7 340int pthread_getconcurrency(void);
224c7076
A
341int pthread_getschedparam(pthread_t , int * __restrict, struct sched_param * __restrict);
342void *pthread_getspecific(pthread_key_t );
343//Begin-Libc
344#ifndef LIBC_ALIAS_PTHREAD_JOIN
345//End-Libc
346int pthread_join(pthread_t , void **) __DARWIN_ALIAS_C(pthread_join);
347//Begin-Libc
348#else /* LIBC_ALIAS_PTHREAD_JOIN */
349int pthread_join(pthread_t , void **) LIBC_ALIAS_C(pthread_join);
350#endif /* !LIBC_ALIAS_PTHREAD_JOIN */
351//End-Libc
352int pthread_key_create(pthread_key_t *, void (*)(void *));
353int pthread_key_delete(pthread_key_t );
354int pthread_mutex_destroy(pthread_mutex_t *);
355int pthread_mutex_getprioceiling(const pthread_mutex_t * __restrict, int * __restrict);
356int pthread_mutex_init(pthread_mutex_t * __restrict, const pthread_mutexattr_t * __restrict);
357int pthread_mutex_lock(pthread_mutex_t *);
358int pthread_mutex_setprioceiling(pthread_mutex_t * __restrict, int, int * __restrict);
359int pthread_mutex_trylock(pthread_mutex_t *);
360int pthread_mutex_unlock(pthread_mutex_t *);
361//Begin-Libc
362#ifndef LIBC_ALIAS_PTHREAD_MUTEXATTR_DESTROY
363//End-Libc
364int pthread_mutexattr_destroy(pthread_mutexattr_t *) __DARWIN_ALIAS(pthread_mutexattr_destroy);
365//Begin-Libc
366#else /* LIBC_ALIAS_PTHREAD_MUTEXATTR_DESTROY */
367int pthread_mutexattr_destroy(pthread_mutexattr_t *) LIBC_ALIAS(pthread_mutexattr_destroy);
368#endif /* !LIBC_ALIAS_PTHREAD_MUTEXATTR_DESTROY */
369//End-Libc
370int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t * __restrict, int * __restrict);
371int pthread_mutexattr_getprotocol(const pthread_mutexattr_t * __restrict, int * __restrict);
372int pthread_mutexattr_getpshared(const pthread_mutexattr_t * __restrict, int * __restrict);
373int pthread_mutexattr_gettype(const pthread_mutexattr_t * __restrict, int * __restrict);
374int pthread_mutexattr_init(pthread_mutexattr_t *);
375int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int);
376int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int);
377int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int );
378int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
379int pthread_once(pthread_once_t *, void (*)(void));
380//Begin-Libc
381#ifndef LIBC_ALIAS_PTHREAD_RWLOCK_DESTROY
382//End-Libc
383int pthread_rwlock_destroy(pthread_rwlock_t * ) __DARWIN_ALIAS(pthread_rwlock_destroy);
384//Begin-Libc
385#else /* LIBC_ALIAS_PTHREAD_RWLOCK_DESTROY */
386int pthread_rwlock_destroy(pthread_rwlock_t * ) LIBC_ALIAS(pthread_rwlock_destroy);
387#endif /* !LIBC_ALIAS_PTHREAD_RWLOCK_DESTROY */
388//End-Libc
389//Begin-Libc
390#ifndef LIBC_ALIAS_PTHREAD_RWLOCK_INIT
391//End-Libc
392int pthread_rwlock_init(pthread_rwlock_t * __restrict, const pthread_rwlockattr_t * __restrict) __DARWIN_ALIAS(pthread_rwlock_init);
393//Begin-Libc
394#else /* LIBC_ALIAS_PTHREAD_RWLOCK_INIT */
395int pthread_rwlock_init(pthread_rwlock_t * __restrict, const pthread_rwlockattr_t * __restrict) LIBC_ALIAS(pthread_rwlock_init);
396#endif /* !LIBC_ALIAS_PTHREAD_RWLOCK_INIT */
397//End-Libc
398//Begin-Libc
399#ifndef LIBC_ALIAS_PTHREAD_RWLOCK_RDLOCK
400//End-Libc
401int pthread_rwlock_rdlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_rdlock);
402//Begin-Libc
403#else /* LIBC_ALIAS_PTHREAD_RWLOCK_RDLOCK */
404int pthread_rwlock_rdlock(pthread_rwlock_t *) LIBC_ALIAS(pthread_rwlock_rdlock);
405#endif /* !LIBC_ALIAS_PTHREAD_RWLOCK_RDLOCK */
406//End-Libc
407//Begin-Libc
408#ifndef LIBC_ALIAS_PTHREAD_RWLOCK_TRYRDLOCK
409//End-Libc
410int pthread_rwlock_tryrdlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_tryrdlock);
411//Begin-Libc
412#else /* LIBC_ALIAS_PTHREAD_RWLOCK_TRYRDLOCK */
413int pthread_rwlock_tryrdlock(pthread_rwlock_t *) LIBC_ALIAS(pthread_rwlock_tryrdlock);
414#endif /* !LIBC_ALIAS_PTHREAD_RWLOCK_TRYRDLOCK */
415//End-Libc
416//Begin-Libc
417#ifndef LIBC_ALIAS_PTHREAD_RWLOCK_TRYWRLOCK
418//End-Libc
419int pthread_rwlock_trywrlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_trywrlock);
420//Begin-Libc
421#else /* LIBC_ALIAS_PTHREAD_RWLOCK_TRYWRLOCK */
422int pthread_rwlock_trywrlock(pthread_rwlock_t *) LIBC_ALIAS(pthread_rwlock_trywrlock);
423#endif /* !LIBC_ALIAS_PTHREAD_RWLOCK_TRYWRLOCK */
424//End-Libc
425//Begin-Libc
426#ifndef LIBC_ALIAS_PTHREAD_RWLOCK_WRLOCK
427//End-Libc
428int pthread_rwlock_wrlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_wrlock);
429//Begin-Libc
430#else /* LIBC_ALIAS_PTHREAD_RWLOCK_WRLOCK */
431int pthread_rwlock_wrlock(pthread_rwlock_t *) LIBC_ALIAS(pthread_rwlock_wrlock);
432#endif /* !LIBC_ALIAS_PTHREAD_RWLOCK_WRLOCK */
433//End-Libc
434//Begin-Libc
435#ifndef LIBC_ALIAS_PTHREAD_RWLOCK_UNLOCK
436//End-Libc
437int pthread_rwlock_unlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_unlock);
438//Begin-Libc
439#else /* LIBC_ALIAS_PTHREAD_RWLOCK_UNLOCK */
440int pthread_rwlock_unlock(pthread_rwlock_t *) LIBC_ALIAS(pthread_rwlock_unlock);
441#endif /* !LIBC_ALIAS_PTHREAD_RWLOCK_UNLOCK */
442//End-Libc
443int pthread_rwlockattr_destroy(pthread_rwlockattr_t *);
444int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t * __restrict,
445 int * __restrict);
446int pthread_rwlockattr_init(pthread_rwlockattr_t *);
447int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *,
448 int );
3d9156a7 449pthread_t pthread_self(void);
5b2abdfb 450
224c7076
A
451//Begin-Libc
452#ifndef LIBC_ALIAS_PTHREAD_SETCANCELSTATE
453//End-Libc
454int pthread_setcancelstate(int , int *) __DARWIN_ALIAS(pthread_setcancelstate);
455//Begin-Libc
456#else /* LIBC_ALIAS_PTHREAD_SETCANCELSTATE */
457int pthread_setcancelstate(int , int *) LIBC_ALIAS(pthread_setcancelstate);
458#endif /* !LIBC_ALIAS_PTHREAD_SETCANCELSTATE */
459//End-Libc
460//Begin-Libc
461#ifndef LIBC_ALIAS_PTHREAD_SETCANCELTYPE
462//End-Libc
463int pthread_setcanceltype(int , int *) __DARWIN_ALIAS(pthread_setcanceltype);
464//Begin-Libc
465#else /* LIBC_ALIAS_PTHREAD_SETCANCELTYPE */
466int pthread_setcanceltype(int , int *) LIBC_ALIAS(pthread_setcanceltype);
467#endif /* !LIBC_ALIAS_PTHREAD_SETCANCELTYPE */
468//End-Libc
3d9156a7 469int pthread_setconcurrency(int);
224c7076
A
470int pthread_setschedparam(pthread_t ,
471 int ,
472 const struct sched_param *);
473int pthread_setspecific(pthread_key_t ,
474 const void *);
3d9156a7
A
475void pthread_testcancel(void) __DARWIN_ALIAS(pthread_testcancel);
476
224c7076 477#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
e9ce8d39 478/* returns non-zero if pthread_create or cthread_fork have been called */
9385eb3d 479int pthread_is_threaded_np(void);
e9ce8d39 480
1f2f436a
A
481int pthread_threadid_np(pthread_t,__uint64_t*) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
482
483int pthread_rwlock_longrdlock_np(pthread_rwlock_t *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA);
484int pthread_rwlock_yieldwrlock_np(pthread_rwlock_t *) __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_NA);
485int pthread_rwlock_downgrade_np(pthread_rwlock_t *);
486int pthread_rwlock_upgrade_np(pthread_rwlock_t *);
487int pthread_rwlock_tryupgrade_np(pthread_rwlock_t *);
488int pthread_rwlock_held_np(pthread_rwlock_t *);
489int pthread_rwlock_rdheld_np(pthread_rwlock_t *);
490int pthread_rwlock_wrheld_np(pthread_rwlock_t *);
34e8f829
A
491
492/*SPI to set and get pthread name*/
1f2f436a
A
493int pthread_getname_np(pthread_t,char*,size_t) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
494int pthread_setname_np(const char*) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2);
5b2abdfb 495/* returns non-zero if the current thread is the main thread */
9385eb3d 496int pthread_main_np(void);
5b2abdfb 497
e9ce8d39 498/* return the mach thread bound to the pthread */
9385eb3d
A
499mach_port_t pthread_mach_thread_np(pthread_t);
500size_t pthread_get_stacksize_np(pthread_t);
501void * pthread_get_stackaddr_np(pthread_t);
e9ce8d39
A
502
503/* Like pthread_cond_signal(), but only wake up the specified pthread */
9385eb3d 504int pthread_cond_signal_thread_np(pthread_cond_t *, pthread_t);
e9ce8d39 505
5b2abdfb 506/* Like pthread_cond_timedwait, but use a relative timeout */
224c7076
A
507int pthread_cond_timedwait_relative_np(pthread_cond_t *,
508 pthread_mutex_t *,
509 const struct timespec *);
5b2abdfb 510
e9ce8d39 511/* Like pthread_create(), but leaves the thread suspended */
224c7076
A
512int pthread_create_suspended_np(pthread_t *,
513 const pthread_attr_t *,
514 void *(*)(void *),
515 void *);
3d9156a7 516int pthread_kill(pthread_t, int);
224c7076 517
1f2f436a 518pthread_t pthread_from_mach_thread_np(mach_port_t) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
224c7076
A
519
520//Begin-Libc
521#ifndef LIBC_ALIAS_PTHREAD_SIGMASK
522//End-Libc
523int pthread_sigmask(int, const sigset_t *, sigset_t *) __DARWIN_ALIAS(pthread_sigmask);
524//Begin-Libc
525#else /* LIBC_ALIAS_PTHREAD_SIGMASK */
526int pthread_sigmask(int, const sigset_t *, sigset_t *) LIBC_ALIAS(pthread_sigmask);
527#endif /* !LIBC_ALIAS_PTHREAD_SIGMASK */
528//End-Libc
3d9156a7 529void pthread_yield_np(void);
224c7076 530#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */
e9ce8d39 531__END_DECLS
224c7076 532#endif /* _PTHREAD_H */