xref: /minix3/external/gpl3/gcc/lib/libstdc++-v3/arch/arm/gthr.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
118a5822eSThomas Veerman /* This file is automatically generated.  DO NOT EDIT! */
2*0a6a1f1dSLionel Sambuc /* Generated from: NetBSD: mknative-gcc,v 1.70 2013/05/05 07:11:34 skrll Exp  */
3*0a6a1f1dSLionel Sambuc /* Generated from: NetBSD: mknative.common,v 1.8 2006/05/26 19:17:21 mrg Exp  */
418a5822eSThomas Veerman 
518a5822eSThomas Veerman /* Threads compatibility routines for libgcc2.  */
618a5822eSThomas Veerman /* Compile this one with gcc.  */
7*0a6a1f1dSLionel Sambuc /* Copyright (C) 1997-2013 Free Software Foundation, Inc.
818a5822eSThomas Veerman 
918a5822eSThomas Veerman This file is part of GCC.
1018a5822eSThomas Veerman 
1118a5822eSThomas Veerman GCC is free software; you can redistribute it and/or modify it under
1218a5822eSThomas Veerman the terms of the GNU General Public License as published by the Free
1318a5822eSThomas Veerman Software Foundation; either version 3, or (at your option) any later
1418a5822eSThomas Veerman version.
1518a5822eSThomas Veerman 
1618a5822eSThomas Veerman GCC is distributed in the hope that it will be useful, but WITHOUT ANY
1718a5822eSThomas Veerman WARRANTY; without even the implied warranty of MERCHANTABILITY or
1818a5822eSThomas Veerman FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1918a5822eSThomas Veerman for more details.
2018a5822eSThomas Veerman 
2118a5822eSThomas Veerman Under Section 7 of GPL version 3, you are granted additional
2218a5822eSThomas Veerman permissions described in the GCC Runtime Library Exception, version
2318a5822eSThomas Veerman 3.1, as published by the Free Software Foundation.
2418a5822eSThomas Veerman 
2518a5822eSThomas Veerman You should have received a copy of the GNU General Public License and
2618a5822eSThomas Veerman a copy of the GCC Runtime Library Exception along with this program;
2718a5822eSThomas Veerman see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
2818a5822eSThomas Veerman <http://www.gnu.org/licenses/>.  */
2918a5822eSThomas Veerman 
3018a5822eSThomas Veerman #ifndef _GLIBCXX_GCC_GTHR_H
3118a5822eSThomas Veerman #define _GLIBCXX_GCC_GTHR_H
3218a5822eSThomas Veerman 
3318a5822eSThomas Veerman #ifndef _GLIBCXX_HIDE_EXPORTS
3418a5822eSThomas Veerman #pragma GCC visibility push(default)
3518a5822eSThomas Veerman #endif
3618a5822eSThomas Veerman 
3718a5822eSThomas Veerman /* If this file is compiled with threads support, it must
3818a5822eSThomas Veerman        #define __GTHREADS 1
3918a5822eSThomas Veerman    to indicate that threads support is present.  Also it has define
4018a5822eSThomas Veerman    function
4118a5822eSThomas Veerman      int __gthread_active_p ()
4218a5822eSThomas Veerman    that returns 1 if thread system is active, 0 if not.
4318a5822eSThomas Veerman 
4418a5822eSThomas Veerman    The threads interface must define the following types:
4518a5822eSThomas Veerman      __gthread_key_t
4618a5822eSThomas Veerman      __gthread_once_t
4718a5822eSThomas Veerman      __gthread_mutex_t
4818a5822eSThomas Veerman      __gthread_recursive_mutex_t
4918a5822eSThomas Veerman 
5018a5822eSThomas Veerman    The threads interface must define the following macros:
5118a5822eSThomas Veerman 
5218a5822eSThomas Veerman      __GTHREAD_ONCE_INIT
5318a5822eSThomas Veerman      		to initialize __gthread_once_t
5418a5822eSThomas Veerman      __GTHREAD_MUTEX_INIT
5518a5822eSThomas Veerman      		to initialize __gthread_mutex_t to get a fast
5618a5822eSThomas Veerman 		non-recursive mutex.
5718a5822eSThomas Veerman      __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:
6118a5822eSThomas Veerman 		  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.
6418a5822eSThomas Veerman      __GTHREAD_RECURSIVE_MUTEX_INIT
6518a5822eSThomas Veerman      __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
6618a5822eSThomas Veerman      		as above, but for a recursive mutex.
6718a5822eSThomas Veerman 
6818a5822eSThomas Veerman    The threads interface must define the following static functions:
6918a5822eSThomas Veerman 
7018a5822eSThomas Veerman      int __gthread_once (__gthread_once_t *once, void (*func) ())
7118a5822eSThomas Veerman 
7218a5822eSThomas Veerman      int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
7318a5822eSThomas Veerman      int __gthread_key_delete (__gthread_key_t key)
7418a5822eSThomas Veerman 
7518a5822eSThomas Veerman      void *__gthread_getspecific (__gthread_key_t key)
7618a5822eSThomas Veerman      int __gthread_setspecific (__gthread_key_t key, const void *ptr)
7718a5822eSThomas Veerman 
7818a5822eSThomas Veerman      int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
79*0a6a1f1dSLionel Sambuc      int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex);
8018a5822eSThomas Veerman 
8118a5822eSThomas Veerman      int __gthread_mutex_lock (__gthread_mutex_t *mutex);
8218a5822eSThomas Veerman      int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
8318a5822eSThomas Veerman      int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
8418a5822eSThomas Veerman 
8518a5822eSThomas Veerman      int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
8618a5822eSThomas Veerman      int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
8718a5822eSThomas Veerman      int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
8818a5822eSThomas Veerman 
8918a5822eSThomas Veerman    The following are supported in POSIX threads only. They are required to
9018a5822eSThomas Veerman    fix a deadlock in static initialization inside libsupc++. The header file
9118a5822eSThomas Veerman    gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
9218a5822eSThomas Veerman    features are supported.
9318a5822eSThomas Veerman 
9418a5822eSThomas Veerman    Types:
9518a5822eSThomas Veerman      __gthread_cond_t
9618a5822eSThomas Veerman 
9718a5822eSThomas Veerman    Macros:
9818a5822eSThomas Veerman      __GTHREAD_COND_INIT
9918a5822eSThomas Veerman      __GTHREAD_COND_INIT_FUNCTION
10018a5822eSThomas Veerman 
10118a5822eSThomas Veerman    Interface:
10218a5822eSThomas Veerman      int __gthread_cond_broadcast (__gthread_cond_t *cond);
10318a5822eSThomas Veerman      int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
10418a5822eSThomas Veerman      int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
10518a5822eSThomas Veerman 					__gthread_recursive_mutex_t *mutex);
10618a5822eSThomas Veerman 
10718a5822eSThomas Veerman    All functions returning int should return zero on success or the error
10818a5822eSThomas Veerman    number.  If the operation is not supported, -1 is returned.
10918a5822eSThomas Veerman 
11018a5822eSThomas Veerman    If the following are also defined, you should
11118a5822eSThomas Veerman      #define __GTHREADS_CXX0X 1
11218a5822eSThomas Veerman    to enable the c++0x thread library.
11318a5822eSThomas Veerman 
11418a5822eSThomas Veerman    Types:
11518a5822eSThomas Veerman      __gthread_t
11618a5822eSThomas Veerman      __gthread_time_t
11718a5822eSThomas Veerman 
11818a5822eSThomas Veerman    Interface:
11918a5822eSThomas Veerman      int __gthread_create (__gthread_t *thread, void *(*func) (void*),
12018a5822eSThomas Veerman                            void *args);
12118a5822eSThomas Veerman      int __gthread_join (__gthread_t thread, void **value_ptr);
12218a5822eSThomas Veerman      int __gthread_detach (__gthread_t thread);
12318a5822eSThomas Veerman      int __gthread_equal (__gthread_t t1, __gthread_t t2);
12418a5822eSThomas Veerman      __gthread_t __gthread_self (void);
12518a5822eSThomas Veerman      int __gthread_yield (void);
12618a5822eSThomas Veerman 
12718a5822eSThomas Veerman      int __gthread_mutex_timedlock (__gthread_mutex_t *m,
12818a5822eSThomas Veerman                                     const __gthread_time_t *abs_timeout);
12918a5822eSThomas Veerman      int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
13018a5822eSThomas Veerman                                           const __gthread_time_t *abs_time);
13118a5822eSThomas Veerman 
13218a5822eSThomas Veerman      int __gthread_cond_signal (__gthread_cond_t *cond);
13318a5822eSThomas Veerman      int __gthread_cond_timedwait (__gthread_cond_t *cond,
13418a5822eSThomas Veerman                                    __gthread_mutex_t *mutex,
13518a5822eSThomas Veerman                                    const __gthread_time_t *abs_timeout);
13618a5822eSThomas Veerman 
13718a5822eSThomas Veerman */
13818a5822eSThomas Veerman 
13918a5822eSThomas Veerman #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 
14818a5822eSThomas Veerman #ifndef _GLIBCXX_GTHREAD_USE_WEAK
14918a5822eSThomas Veerman #define _GLIBCXX_GTHREAD_USE_WEAK 1
15018a5822eSThomas Veerman #endif
15118a5822eSThomas Veerman #endif
15218a5822eSThomas Veerman #include <bits/gthr-default.h>
15318a5822eSThomas Veerman 
15418a5822eSThomas Veerman #ifndef _GLIBCXX_HIDE_EXPORTS
15518a5822eSThomas Veerman #pragma GCC visibility pop
15618a5822eSThomas Veerman #endif
15718a5822eSThomas Veerman 
15818a5822eSThomas Veerman #endif /* ! _GLIBCXX_GCC_GTHR_H */
159