1 /* Threads compatibility routines for libgcc2 and libobjc. */
2 /* Compile this one with gcc. */
3 /* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
4 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 3, or (at your option) any later
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
27 #ifndef GCC_GTHR_POSIX_H
28 #define GCC_GTHR_POSIX_H
30 /* POSIX threads specific definitions.
31 Easy, since the interface is just one-to-one mapping. */
34 #define __GTHREADS_CXX0X 1
36 /* Some implementations of <pthread.h> require this to be defined. */
37 #if !defined(_REENTRANT) && defined(__osf__)
43 #if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \
44 || !defined(_GTHREAD_USE_MUTEX_TIMEDLOCK))
46 # if defined(_POSIX_TIMEOUTS) && _POSIX_TIMEOUTS >= 0
47 # define _GTHREAD_USE_MUTEX_TIMEDLOCK 1
49 # define _GTHREAD_USE_MUTEX_TIMEDLOCK 0
53 typedef pthread_t __gthread_t
;
54 typedef pthread_key_t __gthread_key_t
;
55 typedef pthread_once_t __gthread_once_t
;
56 typedef pthread_mutex_t __gthread_mutex_t
;
57 typedef pthread_mutex_t __gthread_recursive_mutex_t
;
58 typedef pthread_cond_t __gthread_cond_t
;
59 typedef struct timespec __gthread_time_t
;
61 /* POSIX like conditional variables are supported. Please look at comments
62 in gthr.h for details. */
63 #define __GTHREAD_HAS_COND 1
65 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
66 #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
67 #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
68 #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
69 #elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
70 #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
72 #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
74 #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
75 #define __GTHREAD_TIME_INIT {0,0}
77 #if SUPPORTS_WEAK && GTHREAD_USE_WEAK
78 # ifndef __gthrw_pragma
79 # define __gthrw_pragma(pragma)
81 # define __gthrw2(name,name2,type) \
82 static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
83 __gthrw_pragma(weak type)
84 # define __gthrw_(name) __gthrw_ ## name
86 # define __gthrw2(name,name2,type)
87 # define __gthrw_(name) name
90 /* Typically, __gthrw_foo is a weak reference to symbol foo. */
91 #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
93 /* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
94 map a subset of the POSIX pthread API to mangled versions of their
96 #if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
97 #define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
98 __gthrw3(pthread_once
)
99 __gthrw3(pthread_getspecific
)
100 __gthrw3(pthread_setspecific
)
102 __gthrw3(pthread_create
)
103 __gthrw3(pthread_join
)
104 __gthrw3(pthread_detach
)
105 __gthrw3(pthread_equal
)
106 __gthrw3(pthread_self
)
107 __gthrw3(pthread_cancel
)
108 __gthrw3(sched_yield
)
110 __gthrw3(pthread_mutex_lock
)
111 __gthrw3(pthread_mutex_trylock
)
112 #if _GTHREAD_USE_MUTEX_TIMEDLOCK
113 __gthrw3(pthread_mutex_timedlock
)
115 __gthrw3(pthread_mutex_unlock
)
116 __gthrw3(pthread_mutex_init
)
117 __gthrw3(pthread_mutex_destroy
)
119 __gthrw3(pthread_cond_broadcast
)
120 __gthrw3(pthread_cond_signal
)
121 __gthrw3(pthread_cond_wait
)
122 __gthrw3(pthread_cond_timedwait
)
123 __gthrw3(pthread_cond_destroy
)
125 __gthrw(pthread_once
)
126 __gthrw(pthread_getspecific
)
127 __gthrw(pthread_setspecific
)
129 __gthrw(pthread_create
)
130 __gthrw(pthread_join
)
131 __gthrw(pthread_equal
)
132 __gthrw(pthread_self
)
133 __gthrw(pthread_detach
)
135 __gthrw(pthread_cancel
)
139 __gthrw(pthread_mutex_lock
)
140 __gthrw(pthread_mutex_trylock
)
141 #if _GTHREAD_USE_MUTEX_TIMEDLOCK
142 __gthrw(pthread_mutex_timedlock
)
144 __gthrw(pthread_mutex_unlock
)
145 __gthrw(pthread_mutex_init
)
146 __gthrw(pthread_mutex_destroy
)
148 __gthrw(pthread_cond_broadcast
)
149 __gthrw(pthread_cond_signal
)
150 __gthrw(pthread_cond_wait
)
151 __gthrw(pthread_cond_timedwait
)
152 __gthrw(pthread_cond_destroy
)
155 __gthrw(pthread_key_create
)
156 __gthrw(pthread_key_delete
)
157 __gthrw(pthread_mutexattr_init
)
158 __gthrw(pthread_mutexattr_settype
)
159 __gthrw(pthread_mutexattr_destroy
)
162 #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
164 #if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
165 __gthrw3(pthread_cond_init
)
166 __gthrw3(pthread_exit
)
168 __gthrw(pthread_cond_init
)
169 __gthrw(pthread_exit
)
170 #endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
171 #ifdef _POSIX_PRIORITY_SCHEDULING
172 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
173 __gthrw(sched_get_priority_max
)
174 __gthrw(sched_get_priority_min
)
175 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
176 #endif /* _POSIX_PRIORITY_SCHEDULING */
177 __gthrw(pthread_attr_destroy
)
178 __gthrw(pthread_attr_init
)
179 __gthrw(pthread_attr_setdetachstate
)
180 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
181 __gthrw(pthread_getschedparam
)
182 __gthrw(pthread_setschedparam
)
183 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
184 #endif /* _LIBOBJC || _LIBOBJC_WEAK */
186 #if SUPPORTS_WEAK && GTHREAD_USE_WEAK
188 /* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
189 -pthreads is not specified. The functions are dummies and most return an
190 error value. However pthread_once returns 0 without invoking the routine
191 it is passed so we cannot pretend that the interface is active if -pthreads
192 is not specified. On Solaris 2.5.1, the interface is not exposed at all so
193 we need to play the usual game with weak symbols. On Solaris 10 and up, a
194 working interface is always exposed. On FreeBSD 6 and later, libc also
195 exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
196 to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
197 which means the alternate __gthread_active_p below cannot be used there. */
199 #if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
201 static volatile int __gthread_active
= -1;
204 __gthread_trigger (void)
206 __gthread_active
= 1;
210 __gthread_active_p (void)
212 static pthread_mutex_t __gthread_active_mutex
= PTHREAD_MUTEX_INITIALIZER
;
213 static pthread_once_t __gthread_active_once
= PTHREAD_ONCE_INIT
;
215 /* Avoid reading __gthread_active twice on the main code path. */
216 int __gthread_active_latest_value
= __gthread_active
;
218 /* This test is not protected to avoid taking a lock on the main code
219 path so every update of __gthread_active in a threaded program must
220 be atomic with regard to the result of the test. */
221 if (__builtin_expect (__gthread_active_latest_value
< 0, 0))
223 if (__gthrw_(pthread_once
))
225 /* If this really is a threaded program, then we must ensure that
226 __gthread_active has been set to 1 before exiting this block. */
227 __gthrw_(pthread_mutex_lock
) (&__gthread_active_mutex
);
228 __gthrw_(pthread_once
) (&__gthread_active_once
, __gthread_trigger
);
229 __gthrw_(pthread_mutex_unlock
) (&__gthread_active_mutex
);
232 /* Make sure we'll never enter this block again. */
233 if (__gthread_active
< 0)
234 __gthread_active
= 0;
236 __gthread_active_latest_value
= __gthread_active
;
239 return __gthread_active_latest_value
!= 0;
242 #else /* neither FreeBSD nor Solaris */
245 __gthread_active_p (void)
247 /* Android's C library does not provide pthread_cancel, check for
248 `pthread_create' instead. */
250 static void *const __gthread_active_ptr
251 = __extension__ (void *) &__gthrw_(pthread_cancel
);
253 static void *const __gthread_active_ptr
254 = __extension__ (void *) &__gthrw_(pthread_create
);
256 return __gthread_active_ptr
!= 0;
259 #endif /* FreeBSD or Solaris */
261 #else /* not SUPPORTS_WEAK */
263 /* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
264 calls in shared flavors of the HP-UX C library. Most of the stubs
265 have no functionality. The details are described in the "libc cumulative
266 patch" for each subversion of HP-UX 11. There are two special interfaces
267 provided for checking whether an application is linked to a shared pthread
268 library or not. However, these interfaces aren't available in early
269 libpthread libraries. We also need a test that works for archive
270 libraries. We can't use pthread_once as some libc versions call the
271 init function. We also can't use pthread_create or pthread_attr_init
272 as these create a thread and thereby prevent changing the default stack
273 size. The function pthread_default_stacksize_np is available in both
274 the archive and shared versions of libpthread. It can be used to
275 determine the default pthread stack size. There is a stub in some
276 shared libc versions which returns a zero size if pthreads are not
277 active. We provide an equivalent stub to handle cases where libc
278 doesn't provide one. */
280 #if defined(__hppa__) && defined(__hpux__)
282 static volatile int __gthread_active
= -1;
285 __gthread_active_p (void)
287 /* Avoid reading __gthread_active twice on the main code path. */
288 int __gthread_active_latest_value
= __gthread_active
;
291 if (__builtin_expect (__gthread_active_latest_value
< 0, 0))
293 pthread_default_stacksize_np (0, &__s
);
294 __gthread_active
= __s
? 1 : 0;
295 __gthread_active_latest_value
= __gthread_active
;
298 return __gthread_active_latest_value
!= 0;
301 #else /* not hppa-hpux */
304 __gthread_active_p (void)
309 #endif /* hppa-hpux */
311 #endif /* SUPPORTS_WEAK */
315 /* This is the config.h file in libobjc/ */
322 /* Key structure for maintaining thread specific storage */
323 static pthread_key_t _objc_thread_storage
;
324 static pthread_attr_t _objc_thread_attribs
;
326 /* Thread local storage for a single thread */
327 static void *thread_local_storage
= NULL
;
329 /* Backend initialization functions */
331 /* Initialize the threads subsystem. */
333 __gthread_objc_init_thread_system (void)
335 if (__gthread_active_p ())
337 /* Initialize the thread storage key. */
338 if (__gthrw_(pthread_key_create
) (&_objc_thread_storage
, NULL
) == 0)
340 /* The normal default detach state for threads is
341 * PTHREAD_CREATE_JOINABLE which causes threads to not die
342 * when you think they should. */
343 if (__gthrw_(pthread_attr_init
) (&_objc_thread_attribs
) == 0
344 && __gthrw_(pthread_attr_setdetachstate
) (&_objc_thread_attribs
,
345 PTHREAD_CREATE_DETACHED
) == 0)
353 /* Close the threads subsystem. */
355 __gthread_objc_close_thread_system (void)
357 if (__gthread_active_p ()
358 && __gthrw_(pthread_key_delete
) (_objc_thread_storage
) == 0
359 && __gthrw_(pthread_attr_destroy
) (&_objc_thread_attribs
) == 0)
365 /* Backend thread functions */
367 /* Create a new thread of execution. */
368 static inline objc_thread_t
369 __gthread_objc_thread_detach (void (*func
)(void *), void *arg
)
371 objc_thread_t thread_id
;
372 pthread_t new_thread_handle
;
374 if (!__gthread_active_p ())
377 if (!(__gthrw_(pthread_create
) (&new_thread_handle
, &_objc_thread_attribs
,
378 (void *) func
, arg
)))
379 thread_id
= (objc_thread_t
) new_thread_handle
;
386 /* Set the current thread's priority. */
388 __gthread_objc_thread_set_priority (int priority
)
390 if (!__gthread_active_p ())
394 #ifdef _POSIX_PRIORITY_SCHEDULING
395 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
396 pthread_t thread_id
= __gthrw_(pthread_self
) ();
398 struct sched_param params
;
399 int priority_min
, priority_max
;
401 if (__gthrw_(pthread_getschedparam
) (thread_id
, &policy
, ¶ms
) == 0)
403 if ((priority_max
= __gthrw_(sched_get_priority_max
) (policy
)) == -1)
406 if ((priority_min
= __gthrw_(sched_get_priority_min
) (policy
)) == -1)
409 if (priority
> priority_max
)
410 priority
= priority_max
;
411 else if (priority
< priority_min
)
412 priority
= priority_min
;
413 params
.sched_priority
= priority
;
416 * The solaris 7 and several other man pages incorrectly state that
417 * this should be a pointer to policy but pthread.h is universally
420 if (__gthrw_(pthread_setschedparam
) (thread_id
, policy
, ¶ms
) == 0)
423 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
424 #endif /* _POSIX_PRIORITY_SCHEDULING */
429 /* Return the current thread's priority. */
431 __gthread_objc_thread_get_priority (void)
433 #ifdef _POSIX_PRIORITY_SCHEDULING
434 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
435 if (__gthread_active_p ())
438 struct sched_param params
;
440 if (__gthrw_(pthread_getschedparam
) (__gthrw_(pthread_self
) (), &policy
, ¶ms
) == 0)
441 return params
.sched_priority
;
446 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
447 #endif /* _POSIX_PRIORITY_SCHEDULING */
448 return OBJC_THREAD_INTERACTIVE_PRIORITY
;
451 /* Yield our process time to another thread. */
453 __gthread_objc_thread_yield (void)
455 if (__gthread_active_p ())
456 __gthrw_(sched_yield
) ();
459 /* Terminate the current thread. */
461 __gthread_objc_thread_exit (void)
463 if (__gthread_active_p ())
464 /* exit the thread */
465 __gthrw_(pthread_exit
) (&__objc_thread_exit_status
);
467 /* Failed if we reached here */
471 /* Returns an integer value which uniquely describes a thread. */
472 static inline objc_thread_t
473 __gthread_objc_thread_id (void)
475 if (__gthread_active_p ())
476 return (objc_thread_t
) __gthrw_(pthread_self
) ();
478 return (objc_thread_t
) 1;
481 /* Sets the thread's local storage pointer. */
483 __gthread_objc_thread_set_data (void *value
)
485 if (__gthread_active_p ())
486 return __gthrw_(pthread_setspecific
) (_objc_thread_storage
, value
);
489 thread_local_storage
= value
;
494 /* Returns the thread's local storage pointer. */
496 __gthread_objc_thread_get_data (void)
498 if (__gthread_active_p ())
499 return __gthrw_(pthread_getspecific
) (_objc_thread_storage
);
501 return thread_local_storage
;
504 /* Backend mutex functions */
506 /* Allocate a mutex. */
508 __gthread_objc_mutex_allocate (objc_mutex_t mutex
)
510 if (__gthread_active_p ())
512 mutex
->backend
= objc_malloc (sizeof (pthread_mutex_t
));
514 if (__gthrw_(pthread_mutex_init
) ((pthread_mutex_t
*) mutex
->backend
, NULL
))
516 objc_free (mutex
->backend
);
517 mutex
->backend
= NULL
;
525 /* Deallocate a mutex. */
527 __gthread_objc_mutex_deallocate (objc_mutex_t mutex
)
529 if (__gthread_active_p ())
534 * Posix Threads specifically require that the thread be unlocked
535 * for __gthrw_(pthread_mutex_destroy) to work.
540 count
= __gthrw_(pthread_mutex_unlock
) ((pthread_mutex_t
*) mutex
->backend
);
546 if (__gthrw_(pthread_mutex_destroy
) ((pthread_mutex_t
*) mutex
->backend
))
549 objc_free (mutex
->backend
);
550 mutex
->backend
= NULL
;
555 /* Grab a lock on a mutex. */
557 __gthread_objc_mutex_lock (objc_mutex_t mutex
)
559 if (__gthread_active_p ()
560 && __gthrw_(pthread_mutex_lock
) ((pthread_mutex_t
*) mutex
->backend
) != 0)
568 /* Try to grab a lock on a mutex. */
570 __gthread_objc_mutex_trylock (objc_mutex_t mutex
)
572 if (__gthread_active_p ()
573 && __gthrw_(pthread_mutex_trylock
) ((pthread_mutex_t
*) mutex
->backend
) != 0)
581 /* Unlock the mutex */
583 __gthread_objc_mutex_unlock (objc_mutex_t mutex
)
585 if (__gthread_active_p ()
586 && __gthrw_(pthread_mutex_unlock
) ((pthread_mutex_t
*) mutex
->backend
) != 0)
594 /* Backend condition mutex functions */
596 /* Allocate a condition. */
598 __gthread_objc_condition_allocate (objc_condition_t condition
)
600 if (__gthread_active_p ())
602 condition
->backend
= objc_malloc (sizeof (pthread_cond_t
));
604 if (__gthrw_(pthread_cond_init
) ((pthread_cond_t
*) condition
->backend
, NULL
))
606 objc_free (condition
->backend
);
607 condition
->backend
= NULL
;
615 /* Deallocate a condition. */
617 __gthread_objc_condition_deallocate (objc_condition_t condition
)
619 if (__gthread_active_p ())
621 if (__gthrw_(pthread_cond_destroy
) ((pthread_cond_t
*) condition
->backend
))
624 objc_free (condition
->backend
);
625 condition
->backend
= NULL
;
630 /* Wait on the condition */
632 __gthread_objc_condition_wait (objc_condition_t condition
, objc_mutex_t mutex
)
634 if (__gthread_active_p ())
635 return __gthrw_(pthread_cond_wait
) ((pthread_cond_t
*) condition
->backend
,
636 (pthread_mutex_t
*) mutex
->backend
);
641 /* Wake up all threads waiting on this condition. */
643 __gthread_objc_condition_broadcast (objc_condition_t condition
)
645 if (__gthread_active_p ())
646 return __gthrw_(pthread_cond_broadcast
) ((pthread_cond_t
*) condition
->backend
);
651 /* Wake up one thread waiting on this condition. */
653 __gthread_objc_condition_signal (objc_condition_t condition
)
655 if (__gthread_active_p ())
656 return __gthrw_(pthread_cond_signal
) ((pthread_cond_t
*) condition
->backend
);
664 __gthread_create (__gthread_t
*__threadid
, void *(*__func
) (void*),
667 return __gthrw_(pthread_create
) (__threadid
, NULL
, __func
, __args
);
671 __gthread_join (__gthread_t __threadid
, void **__value_ptr
)
673 return __gthrw_(pthread_join
) (__threadid
, __value_ptr
);
677 __gthread_detach (__gthread_t __threadid
)
679 return __gthrw_(pthread_detach
) (__threadid
);
683 __gthread_equal (__gthread_t __t1
, __gthread_t __t2
)
685 return __gthrw_(pthread_equal
) (__t1
, __t2
);
688 static inline __gthread_t
689 __gthread_self (void)
691 return __gthrw_(pthread_self
) ();
695 __gthread_yield (void)
697 return __gthrw_(sched_yield
) ();
701 __gthread_once (__gthread_once_t
*__once
, void (*__func
) (void))
703 if (__gthread_active_p ())
704 return __gthrw_(pthread_once
) (__once
, __func
);
710 __gthread_key_create (__gthread_key_t
*__key
, void (*__dtor
) (void *))
712 return __gthrw_(pthread_key_create
) (__key
, __dtor
);
716 __gthread_key_delete (__gthread_key_t __key
)
718 return __gthrw_(pthread_key_delete
) (__key
);
722 __gthread_getspecific (__gthread_key_t __key
)
724 return __gthrw_(pthread_getspecific
) (__key
);
728 __gthread_setspecific (__gthread_key_t __key
, const void *__ptr
)
730 return __gthrw_(pthread_setspecific
) (__key
, __ptr
);
734 __gthread_mutex_destroy (__gthread_mutex_t
*__mutex
)
736 if (__gthread_active_p ())
737 return __gthrw_(pthread_mutex_destroy
) (__mutex
);
743 __gthread_mutex_lock (__gthread_mutex_t
*__mutex
)
745 if (__gthread_active_p ())
746 return __gthrw_(pthread_mutex_lock
) (__mutex
);
752 __gthread_mutex_trylock (__gthread_mutex_t
*__mutex
)
754 if (__gthread_active_p ())
755 return __gthrw_(pthread_mutex_trylock
) (__mutex
);
760 #if _GTHREAD_USE_MUTEX_TIMEDLOCK
762 __gthread_mutex_timedlock (__gthread_mutex_t
*__mutex
,
763 const __gthread_time_t
*__abs_timeout
)
765 if (__gthread_active_p ())
766 return __gthrw_(pthread_mutex_timedlock
) (__mutex
, __abs_timeout
);
773 __gthread_mutex_unlock (__gthread_mutex_t
*__mutex
)
775 if (__gthread_active_p ())
776 return __gthrw_(pthread_mutex_unlock
) (__mutex
);
781 #ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
783 __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t
*__mutex
)
785 if (__gthread_active_p ())
787 pthread_mutexattr_t __attr
;
790 __r
= __gthrw_(pthread_mutexattr_init
) (&__attr
);
792 __r
= __gthrw_(pthread_mutexattr_settype
) (&__attr
,
793 PTHREAD_MUTEX_RECURSIVE
);
795 __r
= __gthrw_(pthread_mutex_init
) (__mutex
, &__attr
);
797 __r
= __gthrw_(pthread_mutexattr_destroy
) (&__attr
);
805 __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t
*__mutex
)
807 return __gthread_mutex_lock (__mutex
);
811 __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t
*__mutex
)
813 return __gthread_mutex_trylock (__mutex
);
816 #if _GTHREAD_USE_MUTEX_TIMEDLOCK
818 __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t
*__mutex
,
819 const __gthread_time_t
*__abs_timeout
)
821 return __gthread_mutex_timedlock (__mutex
, __abs_timeout
);
826 __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t
*__mutex
)
828 return __gthread_mutex_unlock (__mutex
);
832 __gthread_cond_broadcast (__gthread_cond_t
*__cond
)
834 return __gthrw_(pthread_cond_broadcast
) (__cond
);
838 __gthread_cond_signal (__gthread_cond_t
*__cond
)
840 return __gthrw_(pthread_cond_signal
) (__cond
);
844 __gthread_cond_wait (__gthread_cond_t
*__cond
, __gthread_mutex_t
*__mutex
)
846 return __gthrw_(pthread_cond_wait
) (__cond
, __mutex
);
850 __gthread_cond_timedwait (__gthread_cond_t
*__cond
, __gthread_mutex_t
*__mutex
,
851 const __gthread_time_t
*__abs_timeout
)
853 return __gthrw_(pthread_cond_timedwait
) (__cond
, __mutex
, __abs_timeout
);
857 __gthread_cond_wait_recursive (__gthread_cond_t
*__cond
,
858 __gthread_recursive_mutex_t
*__mutex
)
860 return __gthread_cond_wait (__cond
, __mutex
);
864 __gthread_cond_timedwait_recursive (__gthread_cond_t
*__cond
,
865 __gthread_recursive_mutex_t
*__mutex
,
866 const __gthread_time_t
*__abs_timeout
)
868 return __gthread_cond_timedwait (__cond
, __mutex
, __abs_timeout
);
872 __gthread_cond_destroy (__gthread_cond_t
* __cond
)
874 return __gthrw_(pthread_cond_destroy
) (__cond
);
877 #endif /* _LIBOBJC */
879 #endif /* ! GCC_GTHR_POSIX_H */