gthr-posix.h

00001 /* Threads compatibility routines for libgcc2 and libobjc.  */
00002 /* Compile this one with gcc.  */
00003 /* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
00004    Free Software Foundation, Inc.
00005 
00006 This file is part of GCC.
00007 
00008 GCC is free software; you can redistribute it and/or modify it under
00009 the terms of the GNU General Public License as published by the Free
00010 Software Foundation; either version 2, or (at your option) any later
00011 version.
00012 
00013 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
00014 WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00016 for more details.
00017 
00018 You should have received a copy of the GNU General Public License
00019 along with GCC; see the file COPYING.  If not, write to the Free
00020 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
00021 02110-1301, USA.  */
00022 
00023 /* As a special exception, if you link this library with other files,
00024    some of which are compiled with GCC, to produce an executable,
00025    this library does not by itself cause the resulting executable
00026    to be covered by the GNU General Public License.
00027    This exception does not however invalidate any other reasons why
00028    the executable file might be covered by the GNU General Public License.  */
00029 
00030 #ifndef _GLIBCXX_GCC_GTHR_POSIX_H
00031 #define _GLIBCXX_GCC_GTHR_POSIX_H
00032 
00033 /* POSIX threads specific definitions.
00034    Easy, since the interface is just one-to-one mapping.  */
00035 
00036 #define __GTHREADS 1
00037 
00038 /* Some implementations of <pthread.h> require this to be defined.  */
00039 #if !defined(_REENTRANT) && defined(__osf__)
00040 #define _REENTRANT 1
00041 #endif
00042 
00043 #include <pthread.h>
00044 #include <unistd.h>
00045 
00046 typedef pthread_key_t __gthread_key_t;
00047 typedef pthread_once_t __gthread_once_t;
00048 typedef pthread_mutex_t __gthread_mutex_t;
00049 typedef pthread_mutex_t __gthread_recursive_mutex_t;
00050 
00051 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER
00052 #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT
00053 #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER)
00054 #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER
00055 #elif defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP)
00056 #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
00057 #else
00058 #define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
00059 #endif
00060 
00061 #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
00062 # ifndef __gthrw_pragma
00063 #  define __gthrw_pragma(pragma)
00064 # endif
00065 # define __gthrw2(name,name2,type) \
00066   static __typeof(type) name __attribute__ ((__weakref__(#name2))); \
00067   __gthrw_pragma(weak type)
00068 # define __gthrw_(name) __gthrw_ ## name
00069 #else
00070 # define __gthrw2(name,name2,type)
00071 # define __gthrw_(name) name
00072 #endif
00073 
00074 /* Typically, __gthrw_foo is a weak reference to symbol foo.  */
00075 #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name)
00076 
00077 /* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to
00078    map a subset of the POSIX pthread API to mangled versions of their
00079    names.  */
00080 #if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
00081 #define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name)
00082 __gthrw3(pthread_once)
00083 __gthrw3(pthread_getspecific)
00084 __gthrw3(pthread_setspecific)
00085 __gthrw3(pthread_create)
00086 __gthrw3(pthread_cancel)
00087 __gthrw3(pthread_mutex_lock)
00088 __gthrw3(pthread_mutex_trylock)
00089 __gthrw3(pthread_mutex_unlock)
00090 __gthrw3(pthread_mutex_init)
00091 #else
00092 __gthrw(pthread_once)
00093 __gthrw(pthread_getspecific)
00094 __gthrw(pthread_setspecific)
00095 __gthrw(pthread_create)
00096 __gthrw(pthread_cancel)
00097 __gthrw(pthread_mutex_lock)
00098 __gthrw(pthread_mutex_trylock)
00099 __gthrw(pthread_mutex_unlock)
00100 __gthrw(pthread_mutex_init)
00101 #endif
00102 
00103 __gthrw(pthread_key_create)
00104 __gthrw(pthread_key_delete)
00105 __gthrw(pthread_mutexattr_init)
00106 __gthrw(pthread_mutexattr_settype)
00107 __gthrw(pthread_mutexattr_destroy)
00108 
00109 
00110 #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)
00111 /* Objective-C.  */
00112 #if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_)
00113 __gthrw3(pthread_cond_broadcast)
00114 __gthrw3(pthread_cond_destroy)
00115 __gthrw3(pthread_cond_init)
00116 __gthrw3(pthread_cond_signal)
00117 __gthrw3(pthread_cond_wait)
00118 __gthrw3(pthread_exit)
00119 __gthrw3(pthread_mutex_destroy)
00120 __gthrw3(pthread_self)
00121 #else
00122 __gthrw(pthread_cond_broadcast)
00123 __gthrw(pthread_cond_destroy)
00124 __gthrw(pthread_cond_init)
00125 __gthrw(pthread_cond_signal)
00126 __gthrw(pthread_cond_wait)
00127 __gthrw(pthread_exit)
00128 __gthrw(pthread_mutex_destroy)
00129 __gthrw(pthread_self)
00130 #endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */
00131 #ifdef _POSIX_PRIORITY_SCHEDULING
00132 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
00133 __gthrw(sched_get_priority_max)
00134 __gthrw(sched_get_priority_min)
00135 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
00136 #endif /* _POSIX_PRIORITY_SCHEDULING */
00137 __gthrw(sched_yield)
00138 __gthrw(pthread_attr_destroy)
00139 __gthrw(pthread_attr_init)
00140 __gthrw(pthread_attr_setdetachstate)
00141 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
00142 __gthrw(pthread_getschedparam)
00143 __gthrw(pthread_setschedparam)
00144 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
00145 #endif /* _LIBOBJC || _LIBOBJC_WEAK */
00146 
00147 #if __GXX_WEAK__ && _GLIBCXX_GTHREAD_USE_WEAK
00148 
00149 /* On Solaris 2.6 up to 9, the libc exposes a POSIX threads interface even if
00150    -pthreads is not specified.  The functions are dummies and most return an
00151    error value.  However pthread_once returns 0 without invoking the routine
00152    it is passed so we cannot pretend that the interface is active if -pthreads
00153    is not specified.  On Solaris 2.5.1, the interface is not exposed at all so
00154    we need to play the usual game with weak symbols.  On Solaris 10 and up, a
00155    working interface is always exposed.  On FreeBSD 6 and later, libc also
00156    exposes a dummy POSIX threads interface, similar to what Solaris 2.6 up
00157    to 9 does.  FreeBSD >= 700014 even provides a pthread_cancel stub in libc,
00158    which means the alternate __gthread_active_p below cannot be used there.  */
00159 
00160 #if defined(__FreeBSD__) || (defined(__sun) && defined(__svr4__))
00161 
00162 static volatile int __gthread_active = -1;
00163 
00164 static void
00165 __gthread_trigger (void)
00166 {
00167   __gthread_active = 1;
00168 }
00169 
00170 static inline int
00171 __gthread_active_p (void)
00172 {
00173   static pthread_mutex_t __gthread_active_mutex = PTHREAD_MUTEX_INITIALIZER;
00174   static pthread_once_t __gthread_active_once = PTHREAD_ONCE_INIT;
00175 
00176   /* Avoid reading __gthread_active twice on the main code path.  */
00177   int __gthread_active_latest_value = __gthread_active;
00178 
00179   /* This test is not protected to avoid taking a lock on the main code
00180      path so every update of __gthread_active in a threaded program must
00181      be atomic with regard to the result of the test.  */
00182   if (__builtin_expect (__gthread_active_latest_value < 0, 0))
00183     {
00184       if (__gthrw_(pthread_once))
00185     {
00186       /* If this really is a threaded program, then we must ensure that
00187          __gthread_active has been set to 1 before exiting this block.  */
00188       __gthrw_(pthread_mutex_lock) (&__gthread_active_mutex);
00189       __gthrw_(pthread_once) (&__gthread_active_once, __gthread_trigger);
00190       __gthrw_(pthread_mutex_unlock) (&__gthread_active_mutex);
00191     }
00192 
00193       /* Make sure we'll never enter this block again.  */
00194       if (__gthread_active < 0)
00195     __gthread_active = 0;
00196 
00197       __gthread_active_latest_value = __gthread_active;
00198     }
00199 
00200   return __gthread_active_latest_value != 0;
00201 }
00202 
00203 #else /* neither FreeBSD nor Solaris */
00204 
00205 static inline int
00206 __gthread_active_p (void)
00207 {
00208   static void *const __gthread_active_ptr 
00209     = __extension__ (void *) &__gthrw_(pthread_cancel);
00210   return __gthread_active_ptr != 0;
00211 }
00212 
00213 #endif /* FreeBSD or Solaris */
00214 
00215 #else /* not __GXX_WEAK__ */
00216 
00217 static inline int
00218 __gthread_active_p (void)
00219 {
00220   return 1;
00221 }
00222 
00223 #endif /* __GXX_WEAK__ */
00224 
00225 #ifdef _LIBOBJC
00226 
00227 /* This is the config.h file in libobjc/ */
00228 #include <config.h>
00229 
00230 #ifdef HAVE_SCHED_H
00231 # include <sched.h>
00232 #endif
00233 
00234 /* Key structure for maintaining thread specific storage */
00235 static pthread_key_t _objc_thread_storage;
00236 static pthread_attr_t _objc_thread_attribs;
00237 
00238 /* Thread local storage for a single thread */
00239 static void *thread_local_storage = NULL;
00240 
00241 /* Backend initialization functions */
00242 
00243 /* Initialize the threads subsystem.  */
00244 static inline int
00245 __gthread_objc_init_thread_system (void)
00246 {
00247   if (__gthread_active_p ())
00248     {
00249       /* Initialize the thread storage key.  */
00250       if (__gthrw_(pthread_key_create) (&_objc_thread_storage, NULL) == 0)
00251     {
00252       /* The normal default detach state for threads is
00253        * PTHREAD_CREATE_JOINABLE which causes threads to not die
00254        * when you think they should.  */
00255       if (__gthrw_(pthread_attr_init) (&_objc_thread_attribs) == 0
00256           && __gthrw_(pthread_attr_setdetachstate) (&_objc_thread_attribs,
00257                           PTHREAD_CREATE_DETACHED) == 0)
00258         return 0;
00259     }
00260     }
00261 
00262   return -1;
00263 }
00264 
00265 /* Close the threads subsystem.  */
00266 static inline int
00267 __gthread_objc_close_thread_system (void)
00268 {
00269   if (__gthread_active_p ()
00270       && __gthrw_(pthread_key_delete) (_objc_thread_storage) == 0
00271       && __gthrw_(pthread_attr_destroy) (&_objc_thread_attribs) == 0)
00272     return 0;
00273 
00274   return -1;
00275 }
00276 
00277 /* Backend thread functions */
00278 
00279 /* Create a new thread of execution.  */
00280 static inline objc_thread_t
00281 __gthread_objc_thread_detach (void (*func)(void *), void *arg)
00282 {
00283   objc_thread_t thread_id;
00284   pthread_t new_thread_handle;
00285 
00286   if (!__gthread_active_p ())
00287     return NULL;
00288 
00289   if (!(__gthrw_(pthread_create) (&new_thread_handle, NULL, (void *) func, arg)))
00290     thread_id = (objc_thread_t) new_thread_handle;
00291   else
00292     thread_id = NULL;
00293 
00294   return thread_id;
00295 }
00296 
00297 /* Set the current thread's priority.  */
00298 static inline int
00299 __gthread_objc_thread_set_priority (int priority)
00300 {
00301   if (!__gthread_active_p ())
00302     return -1;
00303   else
00304     {
00305 #ifdef _POSIX_PRIORITY_SCHEDULING
00306 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
00307       pthread_t thread_id = __gthrw_(pthread_self) ();
00308       int policy;
00309       struct sched_param params;
00310       int priority_min, priority_max;
00311 
00312       if (__gthrw_(pthread_getschedparam) (thread_id, &policy, &params) == 0)
00313     {
00314       if ((priority_max = __gthrw_(sched_get_priority_max) (policy)) == -1)
00315         return -1;
00316 
00317       if ((priority_min = __gthrw_(sched_get_priority_min) (policy)) == -1)
00318         return -1;
00319 
00320       if (priority > priority_max)
00321         priority = priority_max;
00322       else if (priority < priority_min)
00323         priority = priority_min;
00324       params.sched_priority = priority;
00325 
00326       /*
00327        * The solaris 7 and several other man pages incorrectly state that
00328        * this should be a pointer to policy but pthread.h is universally
00329        * at odds with this.
00330        */
00331       if (__gthrw_(pthread_setschedparam) (thread_id, policy, &params) == 0)
00332         return 0;
00333     }
00334 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
00335 #endif /* _POSIX_PRIORITY_SCHEDULING */
00336       return -1;
00337     }
00338 }
00339 
00340 /* Return the current thread's priority.  */
00341 static inline int
00342 __gthread_objc_thread_get_priority (void)
00343 {
00344 #ifdef _POSIX_PRIORITY_SCHEDULING
00345 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
00346   if (__gthread_active_p ())
00347     {
00348       int policy;
00349       struct sched_param params;
00350 
00351       if (__gthrw_(pthread_getschedparam) (__gthrw_(pthread_self) (), &policy, &params) == 0)
00352     return params.sched_priority;
00353       else
00354     return -1;
00355     }
00356   else
00357 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
00358 #endif /* _POSIX_PRIORITY_SCHEDULING */
00359     return OBJC_THREAD_INTERACTIVE_PRIORITY;
00360 }
00361 
00362 /* Yield our process time to another thread.  */
00363 static inline void
00364 __gthread_objc_thread_yield (void)
00365 {
00366   if (__gthread_active_p ())
00367     __gthrw_(sched_yield) ();
00368 }
00369 
00370 /* Terminate the current thread.  */
00371 static inline int
00372 __gthread_objc_thread_exit (void)
00373 {
00374   if (__gthread_active_p ())
00375     /* exit the thread */
00376     __gthrw_(pthread_exit) (&__objc_thread_exit_status);
00377 
00378   /* Failed if we reached here */
00379   return -1;
00380 }
00381 
00382 /* Returns an integer value which uniquely describes a thread.  */
00383 static inline objc_thread_t
00384 __gthread_objc_thread_id (void)
00385 {
00386   if (__gthread_active_p ())
00387     return (objc_thread_t) __gthrw_(pthread_self) ();
00388   else
00389     return (objc_thread_t) 1;
00390 }
00391 
00392 /* Sets the thread's local storage pointer.  */
00393 static inline int
00394 __gthread_objc_thread_set_data (void *value)
00395 {
00396   if (__gthread_active_p ())
00397     return __gthrw_(pthread_setspecific) (_objc_thread_storage, value);
00398   else
00399     {
00400       thread_local_storage = value;
00401       return 0;
00402     }
00403 }
00404 
00405 /* Returns the thread's local storage pointer.  */
00406 static inline void *
00407 __gthread_objc_thread_get_data (void)
00408 {
00409   if (__gthread_active_p ())
00410     return __gthrw_(pthread_getspecific) (_objc_thread_storage);
00411   else
00412     return thread_local_storage;
00413 }
00414 
00415 /* Backend mutex functions */
00416 
00417 /* Allocate a mutex.  */
00418 static inline int
00419 __gthread_objc_mutex_allocate (objc_mutex_t mutex)
00420 {
00421   if (__gthread_active_p ())
00422     {
00423       mutex->backend = objc_malloc (sizeof (pthread_mutex_t));
00424 
00425       if (__gthrw_(pthread_mutex_init) ((pthread_mutex_t *) mutex->backend, NULL))
00426     {
00427       objc_free (mutex->backend);
00428       mutex->backend = NULL;
00429       return -1;
00430     }
00431     }
00432 
00433   return 0;
00434 }
00435 
00436 /* Deallocate a mutex.  */
00437 static inline int
00438 __gthread_objc_mutex_deallocate (objc_mutex_t mutex)
00439 {
00440   if (__gthread_active_p ())
00441     {
00442       int count;
00443 
00444       /*
00445        * Posix Threads specifically require that the thread be unlocked
00446        * for __gthrw_(pthread_mutex_destroy) to work.
00447        */
00448 
00449       do
00450     {
00451       count = __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend);
00452       if (count < 0)
00453         return -1;
00454     }
00455       while (count);
00456 
00457       if (__gthrw_(pthread_mutex_destroy) ((pthread_mutex_t *) mutex->backend))
00458     return -1;
00459 
00460       objc_free (mutex->backend);
00461       mutex->backend = NULL;
00462     }
00463   return 0;
00464 }
00465 
00466 /* Grab a lock on a mutex.  */
00467 static inline int
00468 __gthread_objc_mutex_lock (objc_mutex_t mutex)
00469 {
00470   if (__gthread_active_p ()
00471       && __gthrw_(pthread_mutex_lock) ((pthread_mutex_t *) mutex->backend) != 0)
00472     {
00473       return -1;
00474     }
00475 
00476   return 0;
00477 }
00478 
00479 /* Try to grab a lock on a mutex.  */
00480 static inline int
00481 __gthread_objc_mutex_trylock (objc_mutex_t mutex)
00482 {
00483   if (__gthread_active_p ()
00484       && __gthrw_(pthread_mutex_trylock) ((pthread_mutex_t *) mutex->backend) != 0)
00485     {
00486       return -1;
00487     }
00488 
00489   return 0;
00490 }
00491 
00492 /* Unlock the mutex */
00493 static inline int
00494 __gthread_objc_mutex_unlock (objc_mutex_t mutex)
00495 {
00496   if (__gthread_active_p ()
00497       && __gthrw_(pthread_mutex_unlock) ((pthread_mutex_t *) mutex->backend) != 0)
00498     {
00499       return -1;
00500     }
00501 
00502   return 0;
00503 }
00504 
00505 /* Backend condition mutex functions */
00506 
00507 /* Allocate a condition.  */
00508 static inline int
00509 __gthread_objc_condition_allocate (objc_condition_t condition)
00510 {
00511   if (__gthread_active_p ())
00512     {
00513       condition->backend = objc_malloc (sizeof (pthread_cond_t));
00514 
00515       if (__gthrw_(pthread_cond_init) ((pthread_cond_t *) condition->backend, NULL))
00516     {
00517       objc_free (condition->backend);
00518       condition->backend = NULL;
00519       return -1;
00520     }
00521     }
00522 
00523   return 0;
00524 }
00525 
00526 /* Deallocate a condition.  */
00527 static inline int
00528 __gthread_objc_condition_deallocate (objc_condition_t condition)
00529 {
00530   if (__gthread_active_p ())
00531     {
00532       if (__gthrw_(pthread_cond_destroy) ((pthread_cond_t *) condition->backend))
00533     return -1;
00534 
00535       objc_free (condition->backend);
00536       condition->backend = NULL;
00537     }
00538   return 0;
00539 }
00540 
00541 /* Wait on the condition */
00542 static inline int
00543 __gthread_objc_condition_wait (objc_condition_t condition, objc_mutex_t mutex)
00544 {
00545   if (__gthread_active_p ())
00546     return __gthrw_(pthread_cond_wait) ((pthread_cond_t *) condition->backend,
00547                   (pthread_mutex_t *) mutex->backend);
00548   else
00549     return 0;
00550 }
00551 
00552 /* Wake up all threads waiting on this condition.  */
00553 static inline int
00554 __gthread_objc_condition_broadcast (objc_condition_t condition)
00555 {
00556   if (__gthread_active_p ())
00557     return __gthrw_(pthread_cond_broadcast) ((pthread_cond_t *) condition->backend);
00558   else
00559     return 0;
00560 }
00561 
00562 /* Wake up one thread waiting on this condition.  */
00563 static inline int
00564 __gthread_objc_condition_signal (objc_condition_t condition)
00565 {
00566   if (__gthread_active_p ())
00567     return __gthrw_(pthread_cond_signal) ((pthread_cond_t *) condition->backend);
00568   else
00569     return 0;
00570 }
00571 
00572 #else /* _LIBOBJC */
00573 
00574 static inline int
00575 __gthread_once (__gthread_once_t *once, void (*func) (void))
00576 {
00577   if (__gthread_active_p ())
00578     return __gthrw_(pthread_once) (once, func);
00579   else
00580     return -1;
00581 }
00582 
00583 static inline int
00584 __gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
00585 {
00586   return __gthrw_(pthread_key_create) (key, dtor);
00587 }
00588 
00589 static inline int
00590 __gthread_key_delete (__gthread_key_t key)
00591 {
00592   return __gthrw_(pthread_key_delete) (key);
00593 }
00594 
00595 static inline void *
00596 __gthread_getspecific (__gthread_key_t key)
00597 {
00598   return __gthrw_(pthread_getspecific) (key);
00599 }
00600 
00601 static inline int
00602 __gthread_setspecific (__gthread_key_t key, const void *ptr)
00603 {
00604   return __gthrw_(pthread_setspecific) (key, ptr);
00605 }
00606 
00607 static inline int
00608 __gthread_mutex_lock (__gthread_mutex_t *mutex)
00609 {
00610   if (__gthread_active_p ())
00611     return __gthrw_(pthread_mutex_lock) (mutex);
00612   else
00613     return 0;
00614 }
00615 
00616 static inline int
00617 __gthread_mutex_trylock (__gthread_mutex_t *mutex)
00618 {
00619   if (__gthread_active_p ())
00620     return __gthrw_(pthread_mutex_trylock) (mutex);
00621   else
00622     return 0;
00623 }
00624 
00625 static inline int
00626 __gthread_mutex_unlock (__gthread_mutex_t *mutex)
00627 {
00628   if (__gthread_active_p ())
00629     return __gthrw_(pthread_mutex_unlock) (mutex);
00630   else
00631     return 0;
00632 }
00633 
00634 #ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
00635 static inline int
00636 __gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
00637 {
00638   if (__gthread_active_p ())
00639     {
00640       pthread_mutexattr_t attr;
00641       int r;
00642 
00643       r = __gthrw_(pthread_mutexattr_init) (&attr);
00644       if (!r)
00645     r = __gthrw_(pthread_mutexattr_settype) (&attr, PTHREAD_MUTEX_RECURSIVE);
00646       if (!r)
00647     r = __gthrw_(pthread_mutex_init) (mutex, &attr);
00648       if (!r)
00649     r = __gthrw_(pthread_mutexattr_destroy) (&attr);
00650       return r;
00651     }
00652   return 0;
00653 }
00654 #endif
00655 
00656 static inline int
00657 __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
00658 {
00659   return __gthread_mutex_lock (mutex);
00660 }
00661 
00662 static inline int
00663 __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
00664 {
00665   return __gthread_mutex_trylock (mutex);
00666 }
00667 
00668 static inline int
00669 __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
00670 {
00671   return __gthread_mutex_unlock (mutex);
00672 }
00673 
00674 #endif /* _LIBOBJC */
00675 
00676 #endif /* ! _GLIBCXX_GCC_GTHR_POSIX_H */

Generated on Sat Jan 10 19:11:27 2009 for libstdc++ by  doxygen 1.5.8