1 /* This file is automatically generated. DO NOT EDIT! */ 2 /* Generated from: NetBSD: mknative-gcc,v 1.70 2013/05/05 07:11:34 skrll Exp */ 3 /* Generated from: NetBSD: mknative.common,v 1.8 2006/05/26 19:17:21 mrg Exp */ 4 5 /* Threads compatibility routines for libgcc2. */ 6 /* Compile this one with gcc. */ 7 /* Copyright (C) 1997-2013 Free Software Foundation, Inc. 8 9 This file is part of GCC. 10 11 GCC is free software; you can redistribute it and/or modify it under 12 the terms of the GNU General Public License as published by the Free 13 Software Foundation; either version 3, or (at your option) any later 14 version. 15 16 GCC is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or 18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19 for more details. 20 21 Under Section 7 of GPL version 3, you are granted additional 22 permissions described in the GCC Runtime Library Exception, version 23 3.1, as published by the Free Software Foundation. 24 25 You should have received a copy of the GNU General Public License and 26 a copy of the GCC Runtime Library Exception along with this program; 27 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 28 <http://www.gnu.org/licenses/>. */ 29 30 #ifndef _GLIBCXX_GCC_GTHR_H 31 #define _GLIBCXX_GCC_GTHR_H 32 33 #ifndef _GLIBCXX_HIDE_EXPORTS 34 #pragma GCC visibility push(default) 35 #endif 36 37 /* If this file is compiled with threads support, it must 38 #define __GTHREADS 1 39 to indicate that threads support is present. Also it has define 40 function 41 int __gthread_active_p () 42 that returns 1 if thread system is active, 0 if not. 43 44 The threads interface must define the following types: 45 __gthread_key_t 46 __gthread_once_t 47 __gthread_mutex_t 48 __gthread_recursive_mutex_t 49 50 The threads interface must define the following macros: 51 52 __GTHREAD_ONCE_INIT 53 to initialize __gthread_once_t 54 __GTHREAD_MUTEX_INIT 55 to initialize __gthread_mutex_t to get a fast 56 non-recursive mutex. 57 __GTHREAD_MUTEX_INIT_FUNCTION 58 to initialize __gthread_mutex_t to get a fast 59 non-recursive mutex. 60 Define this to a function which looks like this: 61 void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *) 62 Some systems can't initialize a mutex without a 63 function call. Don't define __GTHREAD_MUTEX_INIT in this case. 64 __GTHREAD_RECURSIVE_MUTEX_INIT 65 __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION 66 as above, but for a recursive mutex. 67 68 The threads interface must define the following static functions: 69 70 int __gthread_once (__gthread_once_t *once, void (*func) ()) 71 72 int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *)) 73 int __gthread_key_delete (__gthread_key_t key) 74 75 void *__gthread_getspecific (__gthread_key_t key) 76 int __gthread_setspecific (__gthread_key_t key, const void *ptr) 77 78 int __gthread_mutex_destroy (__gthread_mutex_t *mutex); 79 int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex); 80 81 int __gthread_mutex_lock (__gthread_mutex_t *mutex); 82 int __gthread_mutex_trylock (__gthread_mutex_t *mutex); 83 int __gthread_mutex_unlock (__gthread_mutex_t *mutex); 84 85 int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex); 86 int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex); 87 int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex); 88 89 The following are supported in POSIX threads only. They are required to 90 fix a deadlock in static initialization inside libsupc++. The header file 91 gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra 92 features are supported. 93 94 Types: 95 __gthread_cond_t 96 97 Macros: 98 __GTHREAD_COND_INIT 99 __GTHREAD_COND_INIT_FUNCTION 100 101 Interface: 102 int __gthread_cond_broadcast (__gthread_cond_t *cond); 103 int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex); 104 int __gthread_cond_wait_recursive (__gthread_cond_t *cond, 105 __gthread_recursive_mutex_t *mutex); 106 107 All functions returning int should return zero on success or the error 108 number. If the operation is not supported, -1 is returned. 109 110 If the following are also defined, you should 111 #define __GTHREADS_CXX0X 1 112 to enable the c++0x thread library. 113 114 Types: 115 __gthread_t 116 __gthread_time_t 117 118 Interface: 119 int __gthread_create (__gthread_t *thread, void *(*func) (void*), 120 void *args); 121 int __gthread_join (__gthread_t thread, void **value_ptr); 122 int __gthread_detach (__gthread_t thread); 123 int __gthread_equal (__gthread_t t1, __gthread_t t2); 124 __gthread_t __gthread_self (void); 125 int __gthread_yield (void); 126 127 int __gthread_mutex_timedlock (__gthread_mutex_t *m, 128 const __gthread_time_t *abs_timeout); 129 int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m, 130 const __gthread_time_t *abs_time); 131 132 int __gthread_cond_signal (__gthread_cond_t *cond); 133 int __gthread_cond_timedwait (__gthread_cond_t *cond, 134 __gthread_mutex_t *mutex, 135 const __gthread_time_t *abs_timeout); 136 137 */ 138 139 #if __GXX_WEAK__ 140 /* The pe-coff weak support isn't fully compatible to ELF's weak. 141 For static libraries it might would work, but as we need to deal 142 with shared versions too, we disable it for mingw-targets. */ 143 #ifdef __MINGW32__ 144 #undef _GLIBCXX_GTHREAD_USE_WEAK 145 #define _GLIBCXX_GTHREAD_USE_WEAK 0 146 #endif 147 148 #ifndef _GLIBCXX_GTHREAD_USE_WEAK 149 #define _GLIBCXX_GTHREAD_USE_WEAK 1 150 #endif 151 #endif 152 #include <bits/gthr-default.h> 153 154 #ifndef _GLIBCXX_HIDE_EXPORTS 155 #pragma GCC visibility pop 156 #endif 157 158 #endif /* ! _GLIBCXX_GCC_GTHR_H */ 159