1 /* This file is automatically generated. DO NOT EDIT! */
2 /* Generated from: NetBSD: mknative-gcc,v 1.61 2011/07/03 12:26:02 mrg Exp */
3 /* Generated from: NetBSD: mknative.common,v 1.9 2007/02/05 18:26:01 apb Exp */
5 /* Threads compatibility routines for libgcc2. */
6 /* Compile this one with gcc. */
7 /* Copyright (C) 1997, 1998, 2004, 2008, 2009 Free Software Foundation, Inc.
9 This file is part of GCC.
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
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
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.
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/>. */
30 #ifndef _GLIBCXX_GCC_GTHR_H
31 #define _GLIBCXX_GCC_GTHR_H
33 #ifndef _GLIBCXX_HIDE_EXPORTS
34 #pragma GCC visibility push(default)
37 /* If this file is compiled with threads support, it must
39 to indicate that threads support is present. Also it has define
41 int __gthread_active_p ()
42 that returns 1 if thread system is active, 0 if not.
44 The threads interface must define the following types:
48 __gthread_recursive_mutex_t
50 The threads interface must define the following macros:
53 to initialize __gthread_once_t
55 to initialize __gthread_mutex_t to get a fast
57 __GTHREAD_MUTEX_INIT_FUNCTION
58 some systems can't initialize a mutex without a
59 function call. On such systems, define this to a
60 function which looks like this:
61 void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
62 Don't define __GTHREAD_MUTEX_INIT in this case
63 __GTHREAD_RECURSIVE_MUTEX_INIT
64 __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
65 as above, but for a recursive mutex.
67 The threads interface must define the following static functions:
69 int __gthread_once (__gthread_once_t *once, void (*func) ())
71 int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
72 int __gthread_key_delete (__gthread_key_t key)
74 void *__gthread_getspecific (__gthread_key_t key)
75 int __gthread_setspecific (__gthread_key_t key, const void *ptr)
77 int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
79 int __gthread_mutex_lock (__gthread_mutex_t *mutex);
80 int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
81 int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
83 int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
84 int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
85 int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
87 The following are supported in POSIX threads only. They are required to
88 fix a deadlock in static initialization inside libsupc++. The header file
89 gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
90 features are supported.
97 __GTHREAD_COND_INIT_FUNCTION
100 int __gthread_cond_broadcast (__gthread_cond_t *cond);
101 int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
102 int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
103 __gthread_recursive_mutex_t *mutex);
105 All functions returning int should return zero on success or the error
106 number. If the operation is not supported, -1 is returned.
108 If the following are also defined, you should
109 #define __GTHREADS_CXX0X 1
110 to enable the c++0x thread library.
117 int __gthread_create (__gthread_t *thread, void *(*func) (void*),
119 int __gthread_join (__gthread_t thread, void **value_ptr);
120 int __gthread_detach (__gthread_t thread);
121 int __gthread_equal (__gthread_t t1, __gthread_t t2);
122 __gthread_t __gthread_self (void);
123 int __gthread_yield (void);
125 int __gthread_mutex_timedlock (__gthread_mutex_t *m,
126 const __gthread_time_t *abs_timeout);
127 int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
128 const __gthread_time_t *abs_time);
130 int __gthread_cond_signal (__gthread_cond_t *cond);
131 int __gthread_cond_timedwait (__gthread_cond_t *cond,
132 __gthread_mutex_t *mutex,
133 const __gthread_time_t *abs_timeout);
134 int __gthread_cond_timedwait_recursive (__gthread_cond_t *cond,
135 __gthread_recursive_mutex_t *mutex,
136 const __gthread_time_t *abs_time)
138 Currently supported threads packages are
139 TPF threads with -D__tpf__
140 POSIX/Unix98 threads with -D_PTHREADS
141 POSIX/Unix95 threads with -D_PTHREADS95
142 DCE threads with -D_DCE_THREADS
143 Solaris/UI threads with -D_SOLARIS_THREADS
147 /* Check first for thread specific defines. */
148 #if defined (_GLIBCXX___tpf_GLIBCXX___)
149 #include <bits/gthr-tpf.h>
150 #elif _GLIBCXX__PTHREADS
151 #include <bits/gthr-posix.h>
152 #elif _GLIBCXX__PTHREADS95
153 #include <bits/gthr-posix95.h>
154 #elif _GLIBCXX__DCE_THREADS
155 #include <bits/gthr-dce.h>
156 #elif _GLIBCXX__SOLARIS_THREADS
157 #include <bits/gthr-solaris.h>
159 /* Include GTHREAD_FILE if one is defined. */
160 #elif defined(_GLIBCXX_HAVE_GTHR_DEFAULT)
162 #ifndef _GLIBCXX_GTHREAD_USE_WEAK
163 #define _GLIBCXX_GTHREAD_USE_WEAK 1
166 #include <bits/gthr-default.h>
168 /* Fallback to single thread definitions. */
170 #include <bits/gthr-single.h>
173 #ifndef _GLIBCXX_HIDE_EXPORTS
174 #pragma GCC visibility pop
177 #endif /* ! _GLIBCXX_GCC_GTHR_H */