1use crate::prelude::*;
6
7extern "C" {
8 #[cfg(any(target_os = "android", target_os = "linux"))]
9 pub fn pthread_atfork(
10 prepare: Option<unsafe extern "C" fn()>,
11 parent: Option<unsafe extern "C" fn()>,
12 child: Option<unsafe extern "C" fn()>,
13 ) -> c_int;
14
15 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
16 pub fn pthread_attr_getguardsize(
17 attr: *const crate::pthread_attr_t,
18 guardsize: *mut size_t,
19 ) -> c_int;
20
21 #[cfg(any(
22 target_os = "android",
23 target_os = "l4re",
24 target_os = "linux",
25 target_vendor = "apple",
26 ))]
27 pub fn pthread_attr_getinheritsched(
28 attr: *const crate::pthread_attr_t,
29 inheritsched: *mut c_int,
30 ) -> c_int;
31
32 #[cfg(any(target_os = "l4re", target_os = "linux", target_vendor = "apple"))]
33 pub fn pthread_attr_getschedparam(
34 attr: *const crate::pthread_attr_t,
35 param: *mut crate::sched_param,
36 ) -> c_int;
37
38 #[cfg(any(target_os = "l4re", target_os = "linux", target_vendor = "apple"))]
39 pub fn pthread_attr_getschedpolicy(
40 attr: *const crate::pthread_attr_t,
41 policy: *mut c_int,
42 ) -> c_int;
43
44 #[cfg(any(
45 target_os = "android",
46 target_os = "emscripten",
47 target_os = "linux",
48 target_os = "l4re"
49 ))]
50 pub fn pthread_attr_getstack(
51 attr: *const crate::pthread_attr_t,
52 stackaddr: *mut *mut c_void,
53 stacksize: *mut size_t,
54 ) -> c_int;
55
56 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
57 pub fn pthread_attr_setguardsize(attr: *mut crate::pthread_attr_t, guardsize: size_t) -> c_int;
58
59 #[cfg(any(
60 target_os = "android",
61 target_os = "l4re",
62 target_os = "linux",
63 target_vendor = "apple"
64 ))]
65 pub fn pthread_attr_setinheritsched(
66 attr: *mut crate::pthread_attr_t,
67 inheritsched: c_int,
68 ) -> c_int;
69
70 #[cfg(any(target_os = "l4re", target_os = "linux", target_vendor = "apple"))]
71 pub fn pthread_attr_setschedparam(
72 attr: *mut crate::pthread_attr_t,
73 param: *const crate::sched_param,
74 ) -> c_int;
75
76 #[cfg(any(target_os = "l4re", target_os = "linux", target_vendor = "apple"))]
77 pub fn pthread_attr_setschedpolicy(attr: *mut crate::pthread_attr_t, policy: c_int) -> c_int;
78
79 #[cfg(any(
80 target_os = "android",
81 target_os = "emscripten",
82 target_os = "linux",
83 target_os = "l4re"
84 ))]
85 pub fn pthread_attr_setstack(
86 attr: *mut crate::pthread_attr_t,
87 stackaddr: *mut c_void,
88 stacksize: size_t,
89 ) -> c_int;
90
91 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
92 pub fn pthread_barrier_destroy(barrier: *mut crate::pthread_barrier_t) -> c_int;
93
94 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
95 pub fn pthread_barrier_init(
96 barrier: *mut crate::pthread_barrier_t,
97 attr: *const crate::pthread_barrierattr_t,
98 count: c_uint,
99 ) -> c_int;
100
101 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
102 pub fn pthread_barrier_wait(barrier: *mut crate::pthread_barrier_t) -> c_int;
103
104 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
105 pub fn pthread_barrierattr_destroy(attr: *mut crate::pthread_barrierattr_t) -> c_int;
106
107 #[cfg(any(target_os = "android", target_os = "linux"))]
108 pub fn pthread_barrierattr_getpshared(
109 attr: *const crate::pthread_barrierattr_t,
110 shared: *mut c_int,
111 ) -> c_int;
112
113 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
114 pub fn pthread_barrierattr_init(attr: *mut crate::pthread_barrierattr_t) -> c_int;
115
116 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
117 pub fn pthread_barrierattr_setpshared(
118 attr: *mut crate::pthread_barrierattr_t,
119 shared: c_int,
120 ) -> c_int;
121
122 #[cfg(any(target_os = "l4re", all(target_os = "linux", not(target_env = "ohos"))))]
123 pub fn pthread_cancel(thread: crate::pthread_t) -> c_int;
124
125 #[cfg(any(
126 target_os = "android",
127 target_os = "emscripten",
128 target_os = "linux",
129 target_os = "l4re",
130 ))]
131 pub fn pthread_condattr_getclock(
132 attr: *const crate::pthread_condattr_t,
133 clock_id: *mut crate::clockid_t,
134 ) -> c_int;
135
136 #[cfg(any(
137 target_os = "android",
138 target_os = "l4re",
139 target_os = "linux",
140 target_vendor = "apple",
141 ))]
142 pub fn pthread_condattr_getpshared(
143 attr: *const crate::pthread_condattr_t,
144 pshared: *mut c_int,
145 ) -> c_int;
146
147 #[cfg(any(
148 target_os = "android",
149 target_os = "emscripten",
150 target_os = "linux",
151 target_os = "l4re",
152 ))]
153 pub fn pthread_condattr_setclock(
154 attr: *mut crate::pthread_condattr_t,
155 clock_id: crate::clockid_t,
156 ) -> c_int;
157
158 #[cfg(any(
159 target_os = "android",
160 target_os = "emscripten",
161 target_os = "linux",
162 target_os = "l4re",
163 target_vendor = "apple",
164 ))]
165 pub fn pthread_condattr_setpshared(
166 attr: *mut crate::pthread_condattr_t,
167 pshared: c_int,
168 ) -> c_int;
169
170 #[cfg(any(
171 target_os = "android",
172 target_os = "emscripten",
173 target_os = "l4re",
174 target_os = "linux",
175 ))]
176 pub fn pthread_create(
177 native: *mut crate::pthread_t,
178 attr: *const crate::pthread_attr_t,
179 f: extern "C" fn(*mut c_void) -> *mut c_void,
180 value: *mut c_void,
181 ) -> c_int;
182
183 #[cfg(any(target_os = "android", target_os = "linux"))]
184 pub fn pthread_getcpuclockid(thread: crate::pthread_t, clk_id: *mut crate::clockid_t) -> c_int;
185
186 #[cfg(any(
187 target_os = "android",
188 target_os = "l4re",
189 target_os = "linux",
190 target_vendor = "apple",
191 ))]
192 pub fn pthread_getschedparam(
193 native: crate::pthread_t,
194 policy: *mut c_int,
195 param: *mut crate::sched_param,
196 ) -> c_int;
197
198 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
201 pub fn pthread_kill(thread: crate::pthread_t, sig: c_int) -> c_int;
202
203 #[cfg(all(target_os = "linux", not(target_env = "ohos")))]
204 pub fn pthread_mutex_consistent(mutex: *mut crate::pthread_mutex_t) -> c_int;
205
206 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
207 #[cfg_attr(gnu_time_bits64, link_name = "__pthread_mutex_timedlock64")]
208 pub fn pthread_mutex_timedlock(
209 lock: *mut crate::pthread_mutex_t,
210 abstime: *const crate::timespec,
211 ) -> c_int;
212
213 #[cfg(target_os = "linux")]
214 pub fn pthread_mutexattr_getprotocol(
215 attr: *const crate::pthread_mutexattr_t,
216 protocol: *mut c_int,
217 ) -> c_int;
218
219 #[cfg(any(
220 target_os = "android",
221 target_os = "l4re",
222 target_os = "linux",
223 target_vendor = "apple",
224 ))]
225 pub fn pthread_mutexattr_getpshared(
226 attr: *const crate::pthread_mutexattr_t,
227 pshared: *mut c_int,
228 ) -> c_int;
229
230 #[cfg(all(target_os = "linux", not(target_env = "ohos")))]
231 pub fn pthread_mutexattr_getrobust(
232 attr: *const crate::pthread_mutexattr_t,
233 robustness: *mut c_int,
234 ) -> c_int;
235
236 #[cfg(target_os = "linux")]
237 pub fn pthread_mutexattr_setprotocol(
238 attr: *mut crate::pthread_mutexattr_t,
239 protocol: c_int,
240 ) -> c_int;
241
242 #[cfg(any(
243 target_os = "android",
244 target_os = "emscripten",
245 target_os = "linux",
246 target_os = "l4re",
247 target_vendor = "apple",
248 ))]
249 pub fn pthread_mutexattr_setpshared(
250 attr: *mut crate::pthread_mutexattr_t,
251 pshared: c_int,
252 ) -> c_int;
253
254 #[cfg(all(target_os = "linux", not(target_env = "ohos")))]
255 pub fn pthread_mutexattr_setrobust(
256 attr: *mut crate::pthread_mutexattr_t,
257 robustness: c_int,
258 ) -> c_int;
259
260 #[cfg(any(
261 target_os = "android",
262 target_os = "emscripten",
263 target_os = "linux",
264 target_os = "l4re",
265 target_vendor = "apple",
266 ))]
267 pub fn pthread_rwlockattr_getpshared(
268 attr: *const crate::pthread_rwlockattr_t,
269 val: *mut c_int,
270 ) -> c_int;
271
272 #[cfg(any(
273 target_os = "android",
274 target_os = "emscripten",
275 target_os = "linux",
276 target_os = "l4re",
277 target_vendor = "apple",
278 ))]
279 pub fn pthread_rwlockattr_setpshared(
280 attr: *mut crate::pthread_rwlockattr_t,
281 val: c_int,
282 ) -> c_int;
283
284 #[cfg(any(target_os = "l4re", target_os = "linux"))]
286 pub fn pthread_once(control: *mut crate::pthread_once_t, routine: extern "C" fn()) -> c_int;
287 #[cfg(target_vendor = "apple")]
288 pub fn pthread_once(
289 once_control: *mut crate::pthread_once_t,
290 init_routine: Option<unsafe extern "C" fn()>,
291 ) -> c_int;
292
293 #[cfg(any(
294 target_os = "android",
295 target_os = "l4re",
296 target_os = "linux",
297 target_vendor = "apple",
298 ))]
299 pub fn pthread_setschedparam(
300 native: crate::pthread_t,
301 policy: c_int,
302 param: *const crate::sched_param,
303 ) -> c_int;
304
305 #[cfg(target_os = "linux")]
306 pub fn pthread_setschedprio(native: crate::pthread_t, priority: c_int) -> c_int;
307
308 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
311 pub fn pthread_sigmask(
312 how: c_int,
313 set: *const crate::sigset_t,
314 oldset: *mut crate::sigset_t,
315 ) -> c_int;
316
317 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
318 pub fn pthread_spin_destroy(lock: *mut crate::pthread_spinlock_t) -> c_int;
319
320 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
321 pub fn pthread_spin_init(lock: *mut crate::pthread_spinlock_t, pshared: c_int) -> c_int;
322
323 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
324 pub fn pthread_spin_lock(lock: *mut crate::pthread_spinlock_t) -> c_int;
325
326 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
327 pub fn pthread_spin_trylock(lock: *mut crate::pthread_spinlock_t) -> c_int;
328
329 #[cfg(any(target_os = "android", target_os = "l4re", target_os = "linux"))]
330 pub fn pthread_spin_unlock(lock: *mut crate::pthread_spinlock_t) -> c_int;
331}