]>
Commit | Line | Data |
---|---|---|
bf293afe | 1 | /* Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
76a50749 UD |
2 | This file is part of the GNU C Library. |
3 | Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. | |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
16 | License along with the GNU C Library; if not, write to the Free | |
17 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
18 | 02111-1307 USA. */ | |
19 | ||
20 | #ifndef _PTHREADP_H | |
21 | #define _PTHREADP_H 1 | |
22 | ||
23 | #include <pthread.h> | |
24 | #include <setjmp.h> | |
b758b9cb | 25 | #include <stdbool.h> |
76a50749 UD |
26 | #include <sys/syscall.h> |
27 | #include "descr.h" | |
28 | #include <tls.h> | |
29 | #include <lowlevellock.h> | |
30 | #include <stackinfo.h> | |
31 | #include <internaltypes.h> | |
73e9ae88 | 32 | #include <pthread-functions.h> |
86246935 | 33 | #include <atomic.h> |
76a50749 UD |
34 | |
35 | ||
a1b5424f UD |
36 | /* Atomic operations on TLS memory. */ |
37 | #ifndef THREAD_ATOMIC_CMPXCHG_VAL | |
38 | # define THREAD_ATOMIC_CMPXCHG_VAL(descr, member, new, old) \ | |
39 | atomic_compare_and_exchange_val_acq (&(descr)->member, new, old) | |
40 | #endif | |
41 | ||
42 | #ifndef THREAD_ATOMIC_BIT_SET | |
43 | # define THREAD_ATOMIC_BIT_SET(descr, member, bit) \ | |
44 | atomic_bit_set (&(descr)->member, bit) | |
45 | #endif | |
46 | ||
47 | ||
76a50749 UD |
48 | /* Internal variables. */ |
49 | ||
50 | ||
51 | /* Default stack size. */ | |
52 | extern size_t __default_stacksize attribute_hidden; | |
53 | ||
54 | /* Size and alignment of static TLS block. */ | |
55 | extern size_t __static_tls_size attribute_hidden; | |
bc6389ad | 56 | extern size_t __static_tls_align_m1 attribute_hidden; |
76a50749 UD |
57 | |
58 | /* Thread descriptor handling. */ | |
fa9a4ff0 RM |
59 | extern list_t __stack_user; |
60 | hidden_proto (__stack_user) | |
76a50749 UD |
61 | |
62 | /* Attribute handling. */ | |
63 | extern struct pthread_attr *__attr_list attribute_hidden; | |
64 | extern lll_lock_t __attr_list_lock attribute_hidden; | |
65 | ||
66 | /* First available RT signal. */ | |
67 | extern int __current_sigrtmin attribute_hidden; | |
68 | /* Last available RT signal. */ | |
69 | extern int __current_sigrtmax attribute_hidden; | |
70 | ||
71 | /* Concurrency handling. */ | |
72 | extern int __concurrency_level attribute_hidden; | |
73 | ||
74 | /* Thread-local data key handling. */ | |
fa9a4ff0 RM |
75 | extern struct pthread_key_struct __pthread_keys[PTHREAD_KEYS_MAX]; |
76 | hidden_proto (__pthread_keys) | |
76a50749 | 77 | |
47202270 UD |
78 | /* Number of threads running. */ |
79 | extern unsigned int __nptl_nthreads attribute_hidden; | |
80 | ||
76a50749 UD |
81 | /* The library can run in debugging mode where it performs a lot more |
82 | tests. */ | |
83 | extern int __pthread_debug attribute_hidden; | |
729924a0 UD |
84 | /** For now disable debugging support. */ |
85 | #if 0 | |
86 | # define DEBUGGING_P __builtin_expect (__pthread_debug, 0) | |
8c2e9a29 UD |
87 | # define INVALID_TD_P(pd) (DEBUGGING_P && __find_in_stack_list (pd) == NULL) |
88 | # define INVALID_NOT_TERMINATED_TD_P(pd) INVALID_TD_P (pd) | |
729924a0 UD |
89 | #else |
90 | # define DEBUGGING_P 0 | |
8c2e9a29 UD |
91 | /* Simplified test. This will not catch all invalid descriptors but |
92 | is better than nothing. And if the test triggers the thread | |
93 | descriptor is guaranteed to be invalid. */ | |
94 | # define INVALID_TD_P(pd) __builtin_expect ((pd)->tid <= 0, 0) | |
95 | # define INVALID_NOT_TERMINATED_TD_P(pd) __builtin_expect ((pd)->tid < 0, 0) | |
729924a0 | 96 | #endif |
76a50749 UD |
97 | |
98 | ||
99 | /* Cancellation test. */ | |
100 | #define CANCELLATION_P(self) \ | |
101 | do { \ | |
102 | int cancelhandling = THREAD_GETMEM (self, cancelhandling); \ | |
103 | if (CANCEL_ENABLED_AND_CANCELED (cancelhandling)) \ | |
104 | { \ | |
105 | THREAD_SETMEM (self, result, PTHREAD_CANCELED); \ | |
9ae0909b | 106 | __do_cancel (); \ |
76a50749 UD |
107 | } \ |
108 | } while (0) | |
109 | ||
6efd4814 UD |
110 | |
111 | extern void __pthread_unwind (__pthread_unwind_buf_t *__buf) | |
112 | __cleanup_fct_attribute __attribute ((__noreturn__)) | |
113 | #ifndef SHARED | |
114 | weak_function | |
115 | #endif | |
116 | ; | |
da0c02ee UD |
117 | extern void __pthread_unwind_next (__pthread_unwind_buf_t *__buf) |
118 | __cleanup_fct_attribute __attribute ((__noreturn__)) | |
119 | #ifndef SHARED | |
120 | weak_function | |
121 | #endif | |
122 | ; | |
123 | extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf) | |
124 | __cleanup_fct_attribute; | |
125 | extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf) | |
126 | __cleanup_fct_attribute; | |
56421b23 UD |
127 | #if defined NOT_IN_libc && defined IS_IN_libpthread |
128 | hidden_proto (__pthread_unwind) | |
da0c02ee UD |
129 | hidden_proto (__pthread_unwind_next) |
130 | hidden_proto (__pthread_register_cancel) | |
131 | hidden_proto (__pthread_unregister_cancel) | |
9d79e037 UD |
132 | # ifdef SHARED |
133 | extern void attribute_hidden pthread_cancel_init (void); | |
134 | # endif | |
56421b23 UD |
135 | #endif |
136 | ||
6efd4814 UD |
137 | |
138 | /* Called when a thread reacts on a cancellation request. */ | |
139 | static inline void | |
dd9423a6 | 140 | __attribute ((noreturn, always_inline)) |
6efd4814 UD |
141 | __do_cancel (void) |
142 | { | |
143 | struct pthread *self = THREAD_SELF; | |
144 | ||
145 | /* Make sure we get no more cancellations. */ | |
146 | THREAD_ATOMIC_BIT_SET (self, cancelhandling, EXITING_BIT); | |
147 | ||
148 | __pthread_unwind ((__pthread_unwind_buf_t *) | |
149 | THREAD_GETMEM (self, cleanup_jmp_buf)); | |
150 | } | |
151 | ||
152 | ||
76a50749 | 153 | /* Set cancellation mode to asynchronous. */ |
bdb04f92 UD |
154 | #define CANCEL_ASYNC() \ |
155 | __pthread_enable_asynccancel () | |
76a50749 UD |
156 | /* Reset to previous cancellation mode. */ |
157 | #define CANCEL_RESET(oldtype) \ | |
bdb04f92 | 158 | __pthread_disable_asynccancel (oldtype) |
76a50749 | 159 | |
9634cf9d | 160 | #if !defined NOT_IN_libc |
9ae0909b | 161 | /* Same as CANCEL_ASYNC, but for use in libc.so. */ |
9634cf9d | 162 | # define LIBC_CANCEL_ASYNC() \ |
9ae0909b UD |
163 | __libc_enable_asynccancel () |
164 | /* Same as CANCEL_RESET, but for use in libc.so. */ | |
9634cf9d | 165 | # define LIBC_CANCEL_RESET(oldtype) \ |
9ae0909b | 166 | __libc_disable_asynccancel (oldtype) |
52f3d213 UD |
167 | # define LIBC_CANCEL_HANDLED() \ |
168 | __asm (".globl " __SYMBOL_PREFIX "__libc_enable_asynccancel"); \ | |
169 | __asm (".globl " __SYMBOL_PREFIX "__libc_disable_asynccancel") | |
9634cf9d UD |
170 | #elif defined NOT_IN_libc && defined IS_IN_libpthread |
171 | # define LIBC_CANCEL_ASYNC() CANCEL_ASYNC () | |
172 | # define LIBC_CANCEL_RESET(val) CANCEL_RESET (val) | |
52f3d213 UD |
173 | # define LIBC_CANCEL_HANDLED() \ |
174 | __asm (".globl " __SYMBOL_PREFIX "__pthread_enable_asynccancel"); \ | |
175 | __asm (".globl " __SYMBOL_PREFIX "__pthread_disable_asynccancel") | |
1fde494e UD |
176 | #elif defined NOT_IN_libc && defined IS_IN_librt |
177 | # define LIBC_CANCEL_ASYNC() \ | |
178 | __librt_enable_asynccancel () | |
179 | # define LIBC_CANCEL_RESET(val) \ | |
180 | __librt_disable_asynccancel (val) | |
181 | # define LIBC_CANCEL_HANDLED() \ | |
182 | __asm (".globl " __SYMBOL_PREFIX "__librt_enable_asynccancel"); \ | |
183 | __asm (".globl " __SYMBOL_PREFIX "__librt_disable_asynccancel") | |
9634cf9d UD |
184 | #else |
185 | # define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */ | |
186 | # define LIBC_CANCEL_RESET(val) ((void)(val)) /* Nothing, but evaluate it. */ | |
52f3d213 | 187 | # define LIBC_CANCEL_HANDLED() /* Nothing. */ |
9634cf9d | 188 | #endif |
9ae0909b | 189 | |
2a9ae45c UD |
190 | /* The signal used for asynchronous cancelation. */ |
191 | #define SIGCANCEL __SIGRTMIN | |
192 | ||
193 | ||
e7608d77 UD |
194 | /* Signal needed for the kernel-supported POSIX timer implementation. |
195 | We can reuse the cancellation signal since we can distinguish | |
196 | cancellation from timer expirations. */ | |
197 | #define SIGTIMER SIGCANCEL | |
2a9ae45c | 198 | |
9ae0909b | 199 | |
76a50749 UD |
200 | /* Internal prototypes. */ |
201 | ||
202 | /* Thread list handling. */ | |
203 | extern struct pthread *__find_in_stack_list (struct pthread *pd) | |
90491dc4 | 204 | attribute_hidden internal_function; |
76a50749 UD |
205 | |
206 | /* Deallocate a thread's stack after optionally making sure the thread | |
207 | descriptor is still valid. */ | |
90491dc4 | 208 | extern void __free_tcb (struct pthread *pd) attribute_hidden internal_function; |
76a50749 UD |
209 | |
210 | /* Free allocated stack. */ | |
90491dc4 UD |
211 | extern void __deallocate_stack (struct pthread *pd) |
212 | attribute_hidden internal_function; | |
76a50749 UD |
213 | |
214 | /* Mark all the stacks except for the current one as available. This | |
215 | function also re-initializes the lock for the stack cache. */ | |
216 | extern void __reclaim_stacks (void) attribute_hidden; | |
217 | ||
54ee14b3 UD |
218 | /* Make all threads's stacks executable. */ |
219 | int __make_stacks_executable (void) internal_function attribute_hidden; | |
220 | ||
76a50749 UD |
221 | /* longjmp handling. */ |
222 | extern void __pthread_cleanup_upto (__jmp_buf target, char *targetframe); | |
334fcf2a UD |
223 | #if defined NOT_IN_libc && defined IS_IN_libpthread |
224 | hidden_proto (__pthread_cleanup_upto) | |
225 | #endif | |
76a50749 UD |
226 | |
227 | ||
228 | /* Functions with versioned interfaces. */ | |
229 | extern int __pthread_create_2_1 (pthread_t *newthread, | |
230 | const pthread_attr_t *attr, | |
231 | void *(*start_routine) (void *), void *arg); | |
232 | extern int __pthread_create_2_0 (pthread_t *newthread, | |
233 | const pthread_attr_t *attr, | |
234 | void *(*start_routine) (void *), void *arg); | |
235 | extern int __pthread_attr_init_2_1 (pthread_attr_t *attr); | |
236 | extern int __pthread_attr_init_2_0 (pthread_attr_t *attr); | |
237 | ||
238 | ||
239 | /* Event handlers for libthread_db interface. */ | |
fa9a4ff0 RM |
240 | extern void __nptl_create_event (void); |
241 | extern void __nptl_death_event (void); | |
242 | hidden_proto (__nptl_create_event) | |
243 | hidden_proto (__nptl_death_event) | |
76a50749 | 244 | |
8454830b | 245 | /* Register the generation counter in the libpthread with the libc. */ |
5a03acfe | 246 | #ifdef TLS_MULTIPLE_THREADS_IN_TCB |
8454830b UD |
247 | extern void __libc_pthread_init (unsigned long int *ptr, |
248 | void (*reclaim) (void), | |
5a03acfe UD |
249 | const struct pthread_functions *functions) |
250 | internal_function; | |
251 | #else | |
252 | extern int *__libc_pthread_init (unsigned long int *ptr, | |
253 | void (*reclaim) (void), | |
254 | const struct pthread_functions *functions) | |
255 | internal_function; | |
256 | ||
257 | /* Variable set to a nonzero value if more than one thread runs or ran. */ | |
258 | extern int __pthread_multiple_threads attribute_hidden; | |
259 | /* Pointer to the corresponding variable in libc. */ | |
260 | extern int *__libc_multiple_threads_ptr attribute_hidden; | |
261 | #endif | |
8454830b | 262 | |
4165d44d UD |
263 | /* Find a thread given its TID. */ |
264 | extern struct pthread *__find_thread_by_id (pid_t tid) attribute_hidden; | |
265 | ||
adc12574 UD |
266 | extern void __pthread_init_static_tls (struct link_map *) attribute_hidden; |
267 | ||
76a50749 UD |
268 | |
269 | /* Namespace save aliases. */ | |
8454830b UD |
270 | extern int __pthread_getschedparam (pthread_t thread_id, int *policy, |
271 | struct sched_param *param); | |
272 | extern int __pthread_setschedparam (pthread_t thread_id, int policy, | |
273 | const struct sched_param *param); | |
274 | extern int __pthread_setcancelstate (int state, int *oldstate); | |
76a50749 UD |
275 | extern int __pthread_mutex_init (pthread_mutex_t *__mutex, |
276 | __const pthread_mutexattr_t *__mutexattr); | |
8454830b | 277 | extern int __pthread_mutex_init_internal (pthread_mutex_t *__mutex, |
b758b9cb UD |
278 | __const pthread_mutexattr_t *__mutexattr) |
279 | attribute_hidden; | |
76a50749 | 280 | extern int __pthread_mutex_destroy (pthread_mutex_t *__mutex); |
b758b9cb UD |
281 | extern int __pthread_mutex_destroy_internal (pthread_mutex_t *__mutex) |
282 | attribute_hidden; | |
76a50749 UD |
283 | extern int __pthread_mutex_trylock (pthread_mutex_t *_mutex); |
284 | extern int __pthread_mutex_lock (pthread_mutex_t *__mutex); | |
b758b9cb UD |
285 | extern int __pthread_mutex_lock_internal (pthread_mutex_t *__mutex) |
286 | attribute_hidden; | |
69431c9a | 287 | extern int __pthread_mutex_cond_lock (pthread_mutex_t *__mutex) |
67b78ef9 | 288 | attribute_hidden internal_function; |
76a50749 | 289 | extern int __pthread_mutex_unlock (pthread_mutex_t *__mutex); |
b758b9cb UD |
290 | extern int __pthread_mutex_unlock_internal (pthread_mutex_t *__mutex) |
291 | attribute_hidden; | |
292 | extern int __pthread_mutex_unlock_usercnt (pthread_mutex_t *__mutex, | |
8f31c0ef | 293 | int __decr) |
3a4f2043 | 294 | attribute_hidden internal_function; |
76a50749 UD |
295 | extern int __pthread_mutexattr_init (pthread_mutexattr_t *attr); |
296 | extern int __pthread_mutexattr_destroy (pthread_mutexattr_t *attr); | |
297 | extern int __pthread_mutexattr_settype (pthread_mutexattr_t *attr, int kind); | |
8454830b UD |
298 | extern int __pthread_attr_destroy (pthread_attr_t *attr); |
299 | extern int __pthread_attr_getdetachstate (const pthread_attr_t *attr, | |
300 | int *detachstate); | |
301 | extern int __pthread_attr_setdetachstate (pthread_attr_t *attr, | |
302 | int detachstate); | |
303 | extern int __pthread_attr_getinheritsched (const pthread_attr_t *attr, | |
304 | int *inherit); | |
305 | extern int __pthread_attr_setinheritsched (pthread_attr_t *attr, int inherit); | |
306 | extern int __pthread_attr_getschedparam (const pthread_attr_t *attr, | |
307 | struct sched_param *param); | |
308 | extern int __pthread_attr_setschedparam (pthread_attr_t *attr, | |
309 | const struct sched_param *param); | |
310 | extern int __pthread_attr_getschedpolicy (const pthread_attr_t *attr, | |
311 | int *policy); | |
312 | extern int __pthread_attr_setschedpolicy (pthread_attr_t *attr, int policy); | |
313 | extern int __pthread_attr_getscope (const pthread_attr_t *attr, int *scope); | |
314 | extern int __pthread_attr_setscope (pthread_attr_t *attr, int scope); | |
76a50749 UD |
315 | extern int __pthread_attr_getstackaddr (__const pthread_attr_t *__restrict |
316 | __attr, void **__restrict __stackaddr); | |
317 | extern int __pthread_attr_setstackaddr (pthread_attr_t *__attr, | |
318 | void *__stackaddr); | |
319 | extern int __pthread_attr_getstacksize (__const pthread_attr_t *__restrict | |
320 | __attr, | |
321 | size_t *__restrict __stacksize); | |
322 | extern int __pthread_attr_setstacksize (pthread_attr_t *__attr, | |
323 | size_t __stacksize); | |
324 | extern int __pthread_attr_getstack (__const pthread_attr_t *__restrict __attr, | |
325 | void **__restrict __stackaddr, | |
326 | size_t *__restrict __stacksize); | |
327 | extern int __pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, | |
328 | size_t __stacksize); | |
329 | extern int __pthread_rwlock_init (pthread_rwlock_t *__restrict __rwlock, | |
330 | __const pthread_rwlockattr_t *__restrict | |
331 | __attr); | |
332 | extern int __pthread_rwlock_destroy (pthread_rwlock_t *__rwlock); | |
333 | extern int __pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock); | |
73e9ae88 | 334 | extern int __pthread_rwlock_rdlock_internal (pthread_rwlock_t *__rwlock); |
76a50749 UD |
335 | extern int __pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock); |
336 | extern int __pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock); | |
73e9ae88 | 337 | extern int __pthread_rwlock_wrlock_internal (pthread_rwlock_t *__rwlock); |
76a50749 UD |
338 | extern int __pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock); |
339 | extern int __pthread_rwlock_unlock (pthread_rwlock_t *__rwlock); | |
73e9ae88 | 340 | extern int __pthread_rwlock_unlock_internal (pthread_rwlock_t *__rwlock); |
8454830b UD |
341 | extern int __pthread_cond_broadcast (pthread_cond_t *cond); |
342 | extern int __pthread_cond_destroy (pthread_cond_t *cond); | |
343 | extern int __pthread_cond_init (pthread_cond_t *cond, | |
344 | const pthread_condattr_t *cond_attr); | |
345 | extern int __pthread_cond_signal (pthread_cond_t *cond); | |
346 | extern int __pthread_cond_wait (pthread_cond_t *cond, pthread_mutex_t *mutex); | |
b5facfda UD |
347 | extern int __pthread_cond_timedwait (pthread_cond_t *cond, |
348 | pthread_mutex_t *mutex, | |
349 | const struct timespec *abstime); | |
8454830b UD |
350 | extern int __pthread_condattr_destroy (pthread_condattr_t *attr); |
351 | extern int __pthread_condattr_init (pthread_condattr_t *attr); | |
76a50749 | 352 | extern int __pthread_key_create (pthread_key_t *key, void (*destr) (void *)); |
73e9ae88 UD |
353 | extern int __pthread_key_create_internal (pthread_key_t *key, |
354 | void (*destr) (void *)); | |
76a50749 | 355 | extern void *__pthread_getspecific (pthread_key_t key); |
73e9ae88 | 356 | extern void *__pthread_getspecific_internal (pthread_key_t key); |
76a50749 | 357 | extern int __pthread_setspecific (pthread_key_t key, const void *value); |
73e9ae88 UD |
358 | extern int __pthread_setspecific_internal (pthread_key_t key, |
359 | const void *value); | |
76a50749 UD |
360 | extern int __pthread_once (pthread_once_t *once_control, |
361 | void (*init_routine) (void)); | |
09efc3ba UD |
362 | extern int __pthread_once_internal (pthread_once_t *once_control, |
363 | void (*init_routine) (void)); | |
76a50749 UD |
364 | extern int __pthread_atfork (void (*prepare) (void), void (*parent) (void), |
365 | void (*child) (void)); | |
8454830b UD |
366 | extern pthread_t __pthread_self (void); |
367 | extern int __pthread_equal (pthread_t thread1, pthread_t thread2); | |
09efc3ba | 368 | extern int __pthread_kill (pthread_t threadid, int signo); |
8454830b | 369 | extern void __pthread_exit (void *value); |
09efc3ba | 370 | extern int __pthread_setcanceltype (int type, int *oldtype); |
bdb04f92 | 371 | extern int __pthread_enable_asynccancel (void) attribute_hidden; |
9ae0909b UD |
372 | extern void __pthread_disable_asynccancel (int oldtype) |
373 | internal_function attribute_hidden; | |
374 | ||
997256dd UD |
375 | extern int __pthread_cond_broadcast_2_0 (pthread_cond_2_0_t *cond); |
376 | extern int __pthread_cond_destroy_2_0 (pthread_cond_2_0_t *cond); | |
377 | extern int __pthread_cond_init_2_0 (pthread_cond_2_0_t *cond, | |
05df18c3 | 378 | const pthread_condattr_t *cond_attr); |
997256dd UD |
379 | extern int __pthread_cond_signal_2_0 (pthread_cond_2_0_t *cond); |
380 | extern int __pthread_cond_timedwait_2_0 (pthread_cond_2_0_t *cond, | |
05df18c3 UD |
381 | pthread_mutex_t *mutex, |
382 | const struct timespec *abstime); | |
997256dd | 383 | extern int __pthread_cond_wait_2_0 (pthread_cond_2_0_t *cond, |
05df18c3 UD |
384 | pthread_mutex_t *mutex); |
385 | ||
73e9ae88 | 386 | |
9ae0909b UD |
387 | /* The two functions are in libc.so and not exported. */ |
388 | extern int __libc_enable_asynccancel (void) attribute_hidden; | |
389 | extern void __libc_disable_asynccancel (int oldtype) | |
390 | internal_function attribute_hidden; | |
09efc3ba | 391 | |
1fde494e UD |
392 | |
393 | /* The two functions are in librt.so and not exported. */ | |
394 | extern int __librt_enable_asynccancel (void) attribute_hidden; | |
395 | extern void __librt_disable_asynccancel (int oldtype) | |
396 | internal_function attribute_hidden; | |
397 | ||
1e506629 | 398 | #ifdef IS_IN_libpthread |
09efc3ba | 399 | /* Special versions which use non-exported functions. */ |
73e9ae88 UD |
400 | extern void __pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer, |
401 | void (*routine) (void *), void *arg) | |
09efc3ba | 402 | attribute_hidden; |
1e506629 UD |
403 | # undef pthread_cleanup_push |
404 | # define pthread_cleanup_push(routine,arg) \ | |
09efc3ba | 405 | { struct _pthread_cleanup_buffer _buffer; \ |
73e9ae88 | 406 | __pthread_cleanup_push (&_buffer, (routine), (arg)); |
09efc3ba | 407 | |
73e9ae88 UD |
408 | extern void __pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer, |
409 | int execute) attribute_hidden; | |
1e506629 UD |
410 | # undef pthread_cleanup_pop |
411 | # define pthread_cleanup_pop(execute) \ | |
73e9ae88 | 412 | __pthread_cleanup_pop (&_buffer, (execute)); } |
1e506629 | 413 | #endif |
76a50749 | 414 | |
73e9ae88 UD |
415 | extern void __pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, |
416 | void (*routine) (void *), void *arg); | |
417 | extern void __pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, | |
418 | int execute); | |
419 | ||
6efd4814 UD |
420 | /* Old cleanup interfaces, still used in libc.so. */ |
421 | extern void _pthread_cleanup_push (struct _pthread_cleanup_buffer *buffer, | |
422 | void (*routine) (void *), void *arg); | |
423 | extern void _pthread_cleanup_pop (struct _pthread_cleanup_buffer *buffer, | |
424 | int execute); | |
425 | extern void _pthread_cleanup_push_defer (struct _pthread_cleanup_buffer *buffer, | |
426 | void (*routine) (void *), void *arg); | |
427 | extern void _pthread_cleanup_pop_restore (struct _pthread_cleanup_buffer *buffer, | |
428 | int execute); | |
429 | ||
06f6ca90 UD |
430 | #if defined NOT_IN_libc && defined IS_IN_libpthread |
431 | hidden_proto (pthread_getaffinity_np) | |
432 | #endif | |
433 | ||
76a50749 | 434 | #endif /* pthreadP.h */ |