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 */
5 /* Threads compatibility routines for libgcc2. */
6 /* Compile this one with gcc. */
7 /* Copyright (C) 1997-2013 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 to initialize __gthread_mutex_t to get a fast
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.
68 The threads interface must define the following static functions:
70 int __gthread_once (__gthread_once_t *once, void (*func) ())
72 int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
73 int __gthread_key_delete (__gthread_key_t key)
75 void *__gthread_getspecific (__gthread_key_t key)
76 int __gthread_setspecific (__gthread_key_t key, const void *ptr)
78 int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
79 int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex);
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);
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);
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.
99 __GTHREAD_COND_INIT_FUNCTION
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);
107 All functions returning int should return zero on success or the error
108 number. If the operation is not supported, -1 is returned.
110 If the following are also defined, you should
111 #define __GTHREADS_CXX0X 1
112 to enable the c++0x thread library.
119 int __gthread_create (__gthread_t *thread, void *(*func) (void*),
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);
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);
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);
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. */
144 #undef _GLIBCXX_GTHREAD_USE_WEAK
145 #define _GLIBCXX_GTHREAD_USE_WEAK 0
148 #ifndef _GLIBCXX_GTHREAD_USE_WEAK
149 #define _GLIBCXX_GTHREAD_USE_WEAK 1
152 #include <bits/gthr-default.h>
154 #ifndef _GLIBCXX_HIDE_EXPORTS
155 #pragma GCC visibility pop
158 #endif /* ! _GLIBCXX_GCC_GTHR_H */