]> git.saurik.com Git - apple/libpthread.git/blame - pthread/pthread_spis.h
libpthread-218.1.3.tar.gz
[apple/libpthread.git] / pthread / pthread_spis.h
CommitLineData
f1a1da6c
A
1/*
2 * Copyright (c) 2000-2012 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
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 *
43 */
44/*
45 * MkLinux
46 */
47
48/*
2546420a 49 * Extension SPIs; installed to /usr/include.
f1a1da6c
A
50 */
51
52#ifndef _PTHREAD_SPIS_H
53#define _PTHREAD_SPIS_H
54
55
56#include <pthread/pthread.h>
57
2546420a
A
58#if __has_feature(assume_nonnull)
59_Pragma("clang assume_nonnull begin")
60#endif
f1a1da6c
A
61__BEGIN_DECLS
62
63#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || defined(_DARWIN_C_SOURCE)
64/* firstfit */
65#define PTHREAD_FIRSTFIT_MUTEX_INITIALIZER {_PTHREAD_FIRSTFIT_MUTEX_SIG_init, {0}}
66/*
67 * Mutex attributes
68 */
69#define _PTHREAD_MUTEX_POLICY_NONE 0
70#define _PTHREAD_MUTEX_POLICY_FAIRSHARE 1
71#define _PTHREAD_MUTEX_POLICY_FIRSTFIT 2
72
73/* sets the mutex policy attributes */
74__OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_5_0)
75int pthread_mutexattr_setpolicy_np(pthread_mutexattr_t *, int );
76
77#endif /* (!_POSIX_C_SOURCE && !_XOPEN_SOURCE) || _DARWIN_C_SOURCE */
78
2546420a
A
79__OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_NA)
80void _pthread_mutex_enable_legacy_mode(void);
81
82/*
83 * A version of pthread_create that is safely callable from an injected mach thread.
84 *
85 * The _create introspection hook will not fire for threads created from this function.
86 *
87 * It is not safe to call this function concurrently.
88 */
89__OSX_AVAILABLE(10.12) __IOS_AVAILABLE(10.0)
90__TVOS_AVAILABLE(10.0) __WATCHOS_AVAILABLE(3.0)
91#if !_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT
92int pthread_create_from_mach_thread(
93 pthread_t _Nullable * _Nonnull __restrict,
94 const pthread_attr_t * _Nullable __restrict,
95 void * _Nullable (* _Nonnull)(void * _Nullable),
96 void * _Nullable __restrict);
97#else
98int pthread_create_from_mach_thread(pthread_t * __restrict,
99 const pthread_attr_t * _Nullable __restrict,
100 void *(* _Nonnull)(void *), void * _Nullable __restrict);
101#endif
102
964d3577 103
f1a1da6c 104__END_DECLS
2546420a
A
105#if __has_feature(assume_nonnull)
106_Pragma("clang assume_nonnull end")
107#endif
f1a1da6c
A
108
109#endif /* _PTHREAD_SPIS_H */