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 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__)
44 typedef pthread_t __gthread_t
;
45 typedef pthread_key_t __gthread_key_t
;
46 typedef pthread_once_t __gthread_once_t
;
47 typedef pthread_mutex_t __gthread_mutex_t
;
48 typedef pthread_mutex_t __gthread_recursive_mutex_t
;
49 typedef pthread_cond_t __gthread_cond_t
;
50 typedef struct timespec __gthread_time_t
;
52 /* POSIX like conditional variables are supported. Please look at comments
53 in gthr.h for details. */
54 #define __GTHREAD_HAS_COND 1
56 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
57 #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
58 #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
59 #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
60 #elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
61 #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
63 #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
65 #define __GTHREAD_COND_INIT PTHREAD_COND_INITIALIZER
66 #define __GTHREAD_TIME_INIT {0,0}
68 #if SUPPORTS_WEAK && GTHREAD_USE_WEAK
69 # ifndef __gthrw_pragma
70 # define __gthrw_pragma(pragma)
72 # define __gthrw2(name,name2,type) \
73 static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
74 __gthrw_pragma(weak type)
75 # define __gthrw_(name) __gthrw_ ## name
77 # define __gthrw2(name,name2,type)
78 # define __gthrw_(name) name
81 /* Typically, __gthrw_foo is a weak reference to symbol foo. */
82 #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
84 /* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
85 map a subset of the POSIX pthread API to mangled versions of their
87 #if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
88 #define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
89 __gthrw3(pthread_once
)
90 __gthrw3(pthread_getspecific
)
91 __gthrw3(pthread_setspecific
)
93 __gthrw3(pthread_create
)
94 __gthrw3(pthread_join
)
95 __gthrw3(pthread_detach
)
96 __gthrw3(pthread_equal
)
97 __gthrw3(pthread_self
)
98 __gthrw3(pthread_cancel
)
101 __gthrw3(pthread_mutex_lock
)
102 __gthrw3(pthread_mutex_trylock
)
103 #ifdef _POSIX_TIMEOUTS
104 #if _POSIX_TIMEOUTS >= 0
105 __gthrw3(pthread_mutex_timedlock
)
107 #endif /* _POSIX_TIMEOUTS */
108 __gthrw3(pthread_mutex_unlock
)
109 __gthrw3(pthread_mutex_init
)
110 __gthrw3(pthread_mutex_destroy
)
112 __gthrw3(pthread_cond_broadcast
)
113 __gthrw3(pthread_cond_signal
)
114 __gthrw3(pthread_cond_wait
)
115 __gthrw3(pthread_cond_timedwait
)
116 __gthrw3(pthread_cond_destroy
)
118 __gthrw(pthread_once
)
119 __gthrw(pthread_getspecific
)
120 __gthrw(pthread_setspecific
)
122 __gthrw(pthread_create
)
123 __gthrw(pthread_join
)
124 __gthrw(pthread_equal
)
125 __gthrw(pthread_self
)
126 __gthrw(pthread_detach
)
128 __gthrw(pthread_cancel
)
132 __gthrw(pthread_mutex_lock
)
133 __gthrw(pthread_mutex_trylock
)
134 #ifdef _POSIX_TIMEOUTS
135 #if _POSIX_TIMEOUTS >= 0
136 __gthrw(pthread_mutex_timedlock
)
138 #endif /* _POSIX_TIMEOUTS */
139 __gthrw(pthread_mutex_unlock
)
140 __gthrw(pthread_mutex_init
)
141 __gthrw(pthread_mutex_destroy
)
143 __gthrw(pthread_cond_broadcast
)
144 __gthrw(pthread_cond_signal
)
145 __gthrw(pthread_cond_wait
)
146 __gthrw(pthread_cond_timedwait
)
147 __gthrw(pthread_cond_destroy
)
150 __gthrw(pthread_key_create
)
151 __gthrw(pthread_key_delete
)
152 __gthrw(pthread_mutexattr_init
)
153 __gthrw(pthread_mutexattr_settype
)
154 __gthrw(pthread_mutexattr_destroy
)
157 #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
159 #if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
160 __gthrw3(pthread_cond_init
)
161 __gthrw3(pthread_exit
)
163 __gthrw(pthread_cond_init
)
164 __gthrw(pthread_exit
)
165 #endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
166 #ifdef _POSIX_PRIORITY_SCHEDULING
167 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
168 __gthrw(sched_get_priority_max
)
169 __gthrw(sched_get_priority_min
)
170 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
171 #endif /* _POSIX_PRIORITY_SCHEDULING */
172 __gthrw(pthread_attr_destroy
)
173 __gthrw(pthread_attr_init
)
174 __gthrw(pthread_attr_setdetachstate
)
175 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
176 __gthrw(pthread_getschedparam
)
177 __gthrw(pthread_setschedparam
)
178 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
179 #endif /* _LIBOBJC || _LIBOBJC_WEAK */
181 #if SUPPORTS_WEAK && GTHREAD_USE_WEAK
183 /* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
184 -pthreads is not specified. The functions are dummies and most return an
185 error value. However pthread_once returns 0 without invoking the routine
186 it is passed so we cannot pretend that the interface is active if -pthreads
187 is not specified. On Solaris 2.5.1, the interface is not exposed at all so
188 we need to play the usual game with weak symbols. On Solaris 10 and up, a
189 working interface is always exposed. On FreeBSD 6 and later, libc also
190 exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
191 to 9 does. FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
192 which means the alternate __gthread_active_p below cannot be used there. */
194 #if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
196 static volatile int __gthread_active
= -1;
199 __gthread_trigger (void)
201 __gthread_active
= 1;
205 __gthread_active_p (void)
207 static pthread_mutex_t __gthread_active_mutex
= PTHREAD_MUTEX_INITIALIZER
;
208 static pthread_once_t __gthread_active_once
= PTHREAD_ONCE_INIT
;
210 /* Avoid reading __gthread_active twice on the main code path. */
211 int __gthread_active_latest_value
= __gthread_active
;
213 /* This test is not protected to avoid taking a lock on the main code
214 path so every update of __gthread_active in a threaded program must
215 be atomic with regard to the result of the test. */
216 if (__builtin_expect (__gthread_active_latest_value
< 0, 0))
218 if (__gthrw_(pthread_once
))
220 /* If this really is a threaded program, then we must ensure that
221 __gthread_active has been set to 1 before exiting this block. */
222 __gthrw_(pthread_mutex_lock
) (&__gthread_active_mutex
);
223 __gthrw_(pthread_once
) (&__gthread_active_once
, __gthread_trigger
);
224 __gthrw_(pthread_mutex_unlock
) (&__gthread_active_mutex
);
227 /* Make sure we'll never enter this block again. */
228 if (__gthread_active
< 0)
229 __gthread_active
= 0;
231 __gthread_active_latest_value
= __gthread_active
;
234 return __gthread_active_latest_value
!= 0;
237 #else /* neither FreeBSD nor Solaris */
240 __gthread_active_p (void)
242 static void *const __gthread_active_ptr
243 = __extension__ (void *) &__gthrw_(
244 /* Android's C library does not provide pthread_cancel, check for
245 `pthread_create' instead. */
252 return __gthread_active_ptr
!= 0;
255 #endif /* FreeBSD or Solaris */
257 #else /* not SUPPORTS_WEAK */
259 /* Similar to Solaris, HP-UX 11 for PA-RISC provides stubs for pthread
260 calls in shared flavors of the HP-UX C library. Most of the stubs
261 have no functionality. The details are described in the "libc cumulative
262 patch" for each subversion of HP-UX 11. There are two special interfaces
263 provided for checking whether an application is linked to a pthread
264 library or not. However, these interfaces aren't available in early
265 libc versions. We also can't use pthread_once as some libc versions
266 call the init function. So, we use pthread_create to check whether it
267 is possible to create a thread or not. The stub implementation returns
268 the error number ENOSYS. */
270 #if defined(__hppa__) && defined(__hpux__)
274 static volatile int __gthread_active
= -1;
276 static void __gthread_active_init (void) __attribute__((noinline
));
278 __gthread_active_init (void)
280 static pthread_mutex_t __gthread_active_mutex
= PTHREAD_MUTEX_INITIALIZER
;
283 __gthrw_(pthread_mutex_lock
) (&__gthread_active_mutex
);
284 if (__gthread_active
< 0)
286 pthread_default_stacksize_np (0, &__s
);
287 __gthread_active
= __s
? 1 : 0;
289 __gthrw_(pthread_mutex_unlock
) (&__gthread_active_mutex
);
293 __gthread_active_p (void)
295 /* Avoid reading __gthread_active twice on the main code path. */
296 int __gthread_active_latest_value
= __gthread_active
;
298 /* This test is not protected to avoid taking a lock on the main code
299 path so every update of __gthread_active in a threaded program must
300 be atomic with regard to the result of the test. */
301 if (__builtin_expect (__gthread_active_latest_value
< 0, 0))
303 __gthread_active_init ();
304 __gthread_active_latest_value
= __gthread_active
;
307 return __gthread_active_latest_value
!= 0;
310 #else /* not hppa-hpux */
313 __gthread_active_p (void)
318 #endif /* hppa-hpux */
320 #endif /* SUPPORTS_WEAK */
324 /* This is the config.h file in libobjc/ */
331 /* Key structure for maintaining thread specific storage */
332 static pthread_key_t _objc_thread_storage
;
333 static pthread_attr_t _objc_thread_attribs
;
335 /* Thread local storage for a single thread */
336 static void *thread_local_storage
= NULL
;
338 /* Backend initialization functions */
340 /* Initialize the threads subsystem. */
342 __gthread_objc_init_thread_system (void)
344 if (__gthread_active_p ())
346 /* Initialize the thread storage key. */
347 if (__gthrw_(pthread_key_create
) (&_objc_thread_storage
, NULL
) == 0)
349 /* The normal default detach state for threads is
350 * PTHREAD_CREATE_JOINABLE which causes threads to not die
351 * when you think they should. */
352 if (__gthrw_(pthread_attr_init
) (&_objc_thread_attribs
) == 0
353 && __gthrw_(pthread_attr_setdetachstate
) (&_objc_thread_attribs
,
354 PTHREAD_CREATE_DETACHED
) == 0)
362 /* Close the threads subsystem. */
364 __gthread_objc_close_thread_system (void)
366 if (__gthread_active_p ()
367 && __gthrw_(pthread_key_delete
) (_objc_thread_storage
) == 0
368 && __gthrw_(pthread_attr_destroy
) (&_objc_thread_attribs
) == 0)
374 /* Backend thread functions */
376 /* Create a new thread of execution. */
377 static inline objc_thread_t
378 __gthread_objc_thread_detach (void (*func
)(void *), void *arg
)
380 objc_thread_t thread_id
;
381 pthread_t new_thread_handle
;
383 if (!__gthread_active_p ())
386 if (!(__gthrw_(pthread_create
) (&new_thread_handle
, NULL
, (void *) func
, arg
)))
387 thread_id
= (objc_thread_t
) new_thread_handle
;
394 /* Set the current thread's priority. */
396 __gthread_objc_thread_set_priority (int priority
)
398 if (!__gthread_active_p ())
402 #ifdef _POSIX_PRIORITY_SCHEDULING
403 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
404 pthread_t thread_id
= __gthrw_(pthread_self
) ();
406 struct sched_param params
;
407 int priority_min
, priority_max
;
409 if (__gthrw_(pthread_getschedparam
) (thread_id
, &policy
, ¶ms
) == 0)
411 if ((priority_max
= __gthrw_(sched_get_priority_max
) (policy
)) == -1)
414 if ((priority_min
= __gthrw_(sched_get_priority_min
) (policy
)) == -1)
417 if (priority
> priority_max
)
418 priority
= priority_max
;
419 else if (priority
< priority_min
)
420 priority
= priority_min
;
421 params
.sched_priority
= priority
;
424 * The solaris 7 and several other man pages incorrectly state that
425 * this should be a pointer to policy but pthread.h is universally
428 if (__gthrw_(pthread_setschedparam
) (thread_id
, policy
, ¶ms
) == 0)
431 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
432 #endif /* _POSIX_PRIORITY_SCHEDULING */
437 /* Return the current thread's priority. */
439 __gthread_objc_thread_get_priority (void)
441 #ifdef _POSIX_PRIORITY_SCHEDULING
442 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
443 if (__gthread_active_p ())
446 struct sched_param params
;
448 if (__gthrw_(pthread_getschedparam
) (__gthrw_(pthread_self
) (), &policy
, ¶ms
) == 0)
449 return params
.sched_priority
;
454 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
455 #endif /* _POSIX_PRIORITY_SCHEDULING */
456 return OBJC_THREAD_INTERACTIVE_PRIORITY
;
459 /* Yield our process time to another thread. */
461 __gthread_objc_thread_yield (void)
463 if (__gthread_active_p ())
464 __gthrw_(sched_yield
) ();
467 /* Terminate the current thread. */
469 __gthread_objc_thread_exit (void)
471 if (__gthread_active_p ())
472 /* exit the thread */
473 __gthrw_(pthread_exit
) (&__objc_thread_exit_status
);
475 /* Failed if we reached here */
479 /* Returns an integer value which uniquely describes a thread. */
480 static inline objc_thread_t
481 __gthread_objc_thread_id (void)
483 if (__gthread_active_p ())
484 return (objc_thread_t
) __gthrw_(pthread_self
) ();
486 return (objc_thread_t
) 1;
489 /* Sets the thread's local storage pointer. */
491 __gthread_objc_thread_set_data (void *value
)
493 if (__gthread_active_p ())
494 return __gthrw_(pthread_setspecific
) (_objc_thread_storage
, value
);
497 thread_local_storage
= value
;
502 /* Returns the thread's local storage pointer. */
504 __gthread_objc_thread_get_data (void)
506 if (__gthread_active_p ())
507 return __gthrw_(pthread_getspecific
) (_objc_thread_storage
);
509 return thread_local_storage
;
512 /* Backend mutex functions */
514 /* Allocate a mutex. */
516 __gthread_objc_mutex_allocate (objc_mutex_t mutex
)
518 if (__gthread_active_p ())
520 mutex
->backend
= objc_malloc (sizeof (pthread_mutex_t
));
522 if (__gthrw_(pthread_mutex_init
) ((pthread_mutex_t
*) mutex
->backend
, NULL
))
524 objc_free (mutex
->backend
);
525 mutex
->backend
= NULL
;
533 /* Deallocate a mutex. */
535 __gthread_objc_mutex_deallocate (objc_mutex_t mutex
)
537 if (__gthread_active_p ())
542 * Posix Threads specifically require that the thread be unlocked
543 * for __gthrw_(pthread_mutex_destroy) to work.
548 count
= __gthrw_(pthread_mutex_unlock
) ((pthread_mutex_t
*) mutex
->backend
);
554 if (__gthrw_(pthread_mutex_destroy
) ((pthread_mutex_t
*) mutex
->backend
))
557 objc_free (mutex
->backend
);
558 mutex
->backend
= NULL
;
563 /* Grab a lock on a mutex. */
565 __gthread_objc_mutex_lock (objc_mutex_t mutex
)
567 if (__gthread_active_p ()
568 && __gthrw_(pthread_mutex_lock
) ((pthread_mutex_t
*) mutex
->backend
) != 0)
576 /* Try to grab a lock on a mutex. */
578 __gthread_objc_mutex_trylock (objc_mutex_t mutex
)
580 if (__gthread_active_p ()
581 && __gthrw_(pthread_mutex_trylock
) ((pthread_mutex_t
*) mutex
->backend
) != 0)
589 /* Unlock the mutex */
591 __gthread_objc_mutex_unlock (objc_mutex_t mutex
)
593 if (__gthread_active_p ()
594 && __gthrw_(pthread_mutex_unlock
) ((pthread_mutex_t
*) mutex
->backend
) != 0)
602 /* Backend condition mutex functions */
604 /* Allocate a condition. */
606 __gthread_objc_condition_allocate (objc_condition_t condition
)
608 if (__gthread_active_p ())
610 condition
->backend
= objc_malloc (sizeof (pthread_cond_t
));
612 if (__gthrw_(pthread_cond_init
) ((pthread_cond_t
*) condition
->backend
, NULL
))
614 objc_free (condition
->backend
);
615 condition
->backend
= NULL
;
623 /* Deallocate a condition. */
625 __gthread_objc_condition_deallocate (objc_condition_t condition
)
627 if (__gthread_active_p ())
629 if (__gthrw_(pthread_cond_destroy
) ((pthread_cond_t
*) condition
->backend
))
632 objc_free (condition
->backend
);
633 condition
->backend
= NULL
;
638 /* Wait on the condition */
640 __gthread_objc_condition_wait (objc_condition_t condition
, objc_mutex_t mutex
)
642 if (__gthread_active_p ())
643 return __gthrw_(pthread_cond_wait
) ((pthread_cond_t
*) condition
->backend
,
644 (pthread_mutex_t
*) mutex
->backend
);
649 /* Wake up all threads waiting on this condition. */
651 __gthread_objc_condition_broadcast (objc_condition_t condition
)
653 if (__gthread_active_p ())
654 return __gthrw_(pthread_cond_broadcast
) ((pthread_cond_t
*) condition
->backend
);
659 /* Wake up one thread waiting on this condition. */
661 __gthread_objc_condition_signal (objc_condition_t condition
)
663 if (__gthread_active_p ())
664 return __gthrw_(pthread_cond_signal
) ((pthread_cond_t
*) condition
->backend
);
672 __gthread_create (__gthread_t
*__threadid
, void *(*__func
) (void*),
675 return __gthrw_(pthread_create
) (__threadid
, NULL
, __func
, __args
);
679 __gthread_join (__gthread_t __threadid
, void **__value_ptr
)
681 return __gthrw_(pthread_join
) (__threadid
, __value_ptr
);
685 __gthread_detach (__gthread_t __threadid
)
687 return __gthrw_(pthread_detach
) (__threadid
);
691 __gthread_equal (__gthread_t __t1
, __gthread_t __t2
)
693 return __gthrw_(pthread_equal
) (__t1
, __t2
);
696 static inline __gthread_t
697 __gthread_self (void)
699 return __gthrw_(pthread_self
) ();
703 __gthread_yield (void)
705 return __gthrw_(sched_yield
) ();
709 __gthread_once (__gthread_once_t
*__once
, void (*__func
) (void))
711 if (__gthread_active_p ())
712 return __gthrw_(pthread_once
) (__once
, __func
);
718 __gthread_key_create (__gthread_key_t
*__key
, void (*__dtor
) (void *))
720 return __gthrw_(pthread_key_create
) (__key
, __dtor
);
724 __gthread_key_delete (__gthread_key_t __key
)
726 return __gthrw_(pthread_key_delete
) (__key
);
730 __gthread_getspecific (__gthread_key_t __key
)
732 return __gthrw_(pthread_getspecific
) (__key
);
736 __gthread_setspecific (__gthread_key_t __key
, const void *__ptr
)
738 return __gthrw_(pthread_setspecific
) (__key
, __ptr
);
742 __gthread_mutex_destroy (__gthread_mutex_t
*__mutex
)
744 if (__gthread_active_p ())
745 return __gthrw_(pthread_mutex_destroy
) (__mutex
);
751 __gthread_mutex_lock (__gthread_mutex_t
*__mutex
)
753 if (__gthread_active_p ())
754 return __gthrw_(pthread_mutex_lock
) (__mutex
);
760 __gthread_mutex_trylock (__gthread_mutex_t
*__mutex
)
762 if (__gthread_active_p ())
763 return __gthrw_(pthread_mutex_trylock
) (__mutex
);
768 #ifdef _POSIX_TIMEOUTS
769 #if _POSIX_TIMEOUTS >= 0
771 __gthread_mutex_timedlock (__gthread_mutex_t
*__mutex
,
772 const __gthread_time_t
*__abs_timeout
)
774 if (__gthread_active_p ())
775 return __gthrw_(pthread_mutex_timedlock
) (__mutex
, __abs_timeout
);
783 __gthread_mutex_unlock (__gthread_mutex_t
*__mutex
)
785 if (__gthread_active_p ())
786 return __gthrw_(pthread_mutex_unlock
) (__mutex
);
791 #ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
793 __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t
*__mutex
)
795 if (__gthread_active_p ())
797 pthread_mutexattr_t __attr
;
800 __r
= __gthrw_(pthread_mutexattr_init
) (&__attr
);
802 __r
= __gthrw_(pthread_mutexattr_settype
) (&__attr
,
803 PTHREAD_MUTEX_RECURSIVE
);
805 __r
= __gthrw_(pthread_mutex_init
) (__mutex
, &__attr
);
807 __r
= __gthrw_(pthread_mutexattr_destroy
) (&__attr
);
815 __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t
*__mutex
)
817 return __gthread_mutex_lock (__mutex
);
821 __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t
*__mutex
)
823 return __gthread_mutex_trylock (__mutex
);
826 #ifdef _POSIX_TIMEOUTS
827 #if _POSIX_TIMEOUTS >= 0
829 __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t
*__mutex
,
830 const __gthread_time_t
*__abs_timeout
)
832 return __gthread_mutex_timedlock (__mutex
, __abs_timeout
);
838 __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t
*__mutex
)
840 return __gthread_mutex_unlock (__mutex
);
844 __gthread_cond_broadcast (__gthread_cond_t
*__cond
)
846 return __gthrw_(pthread_cond_broadcast
) (__cond
);
850 __gthread_cond_signal (__gthread_cond_t
*__cond
)
852 return __gthrw_(pthread_cond_signal
) (__cond
);
856 __gthread_cond_wait (__gthread_cond_t
*__cond
, __gthread_mutex_t
*__mutex
)
858 return __gthrw_(pthread_cond_wait
) (__cond
, __mutex
);
862 __gthread_cond_timedwait (__gthread_cond_t
*__cond
, __gthread_mutex_t
*__mutex
,
863 const __gthread_time_t
*__abs_timeout
)
865 return __gthrw_(pthread_cond_timedwait
) (__cond
, __mutex
, __abs_timeout
);
869 __gthread_cond_wait_recursive (__gthread_cond_t
*__cond
,
870 __gthread_recursive_mutex_t
*__mutex
)
872 return __gthread_cond_wait (__cond
, __mutex
);
876 __gthread_cond_timedwait_recursive (__gthread_cond_t
*__cond
,
877 __gthread_recursive_mutex_t
*__mutex
,
878 const __gthread_time_t
*__abs_timeout
)
880 return __gthread_cond_timedwait (__cond
, __mutex
, __abs_timeout
);
884 __gthread_cond_destroy (__gthread_cond_t
* __cond
)
886 return __gthrw_(pthread_cond_destroy
) (__cond
);
889 #endif /* _LIBOBJC */
891 #endif /* ! GCC_GTHR_POSIX_H */