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