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  */
4
5/* Threads compatibility routines for libgcc2.  */
6/* Compile this one with gcc.  */
7/* Copyright (C) 1997, 1998, 2004, 2008, 2009 Free Software Foundation, Inc.
8
9This file is part of GCC.
10
11GCC is free software; you can redistribute it and/or modify it under
12the terms of the GNU General Public License as published by the Free
13Software Foundation; either version 3, or (at your option) any later
14version.
15
16GCC is distributed in the hope that it will be useful, but WITHOUT ANY
17WARRANTY; without even the implied warranty of MERCHANTABILITY or
18FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19for more details.
20
21Under Section 7 of GPL version 3, you are granted additional
22permissions described in the GCC Runtime Library Exception, version
233.1, as published by the Free Software Foundation.
24
25You should have received a copy of the GNU General Public License and
26a copy of the GCC Runtime Library Exception along with this program;
27see 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     		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.
66
67   The threads interface must define the following static functions:
68
69     int __gthread_once (__gthread_once_t *once, void (*func) ())
70
71     int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
72     int __gthread_key_delete (__gthread_key_t key)
73
74     void *__gthread_getspecific (__gthread_key_t key)
75     int __gthread_setspecific (__gthread_key_t key, const void *ptr)
76
77     int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
78
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);
82
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);
86
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.
91
92   Types:
93     __gthread_cond_t
94
95   Macros:
96     __GTHREAD_COND_INIT
97     __GTHREAD_COND_INIT_FUNCTION
98
99   Interface:
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);
104
105   All functions returning int should return zero on success or the error
106   number.  If the operation is not supported, -1 is returned.
107
108   If the following are also defined, you should
109     #define __GTHREADS_CXX0X 1
110   to enable the c++0x thread library.
111
112   Types:
113     __gthread_t
114     __gthread_time_t
115
116   Interface:
117     int __gthread_create (__gthread_t *thread, void *(*func) (void*),
118                           void *args);
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);
124
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);
129
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)
137
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
144
145*/
146
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>
158
159/* Include GTHREAD_FILE if one is defined.  */
160#elif defined(_GLIBCXX_HAVE_GTHR_DEFAULT)
161#if __GXX_WEAK__
162#ifndef _GLIBCXX_GTHREAD_USE_WEAK
163#define _GLIBCXX_GTHREAD_USE_WEAK 1
164#endif
165#endif
166#include <bits/gthr-default.h>
167
168/* Fallback to single thread definitions.  */
169#else
170#include <bits/gthr-single.h>
171#endif
172
173#ifndef _GLIBCXX_HIDE_EXPORTS
174#pragma GCC visibility pop
175#endif
176
177#endif /* ! _GLIBCXX_GCC_GTHR_H */
178