xref: /minix3/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv4/gthr.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
184d9c625SLionel Sambuc /* 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  */
484d9c625SLionel Sambuc 
584d9c625SLionel Sambuc /* Threads compatibility routines for libgcc2.  */
684d9c625SLionel Sambuc /* Compile this one with gcc.  */
7*0a6a1f1dSLionel Sambuc /* Copyright (C) 1997-2013 Free Software Foundation, Inc.
884d9c625SLionel Sambuc 
984d9c625SLionel Sambuc This file is part of GCC.
1084d9c625SLionel Sambuc 
1184d9c625SLionel Sambuc GCC is free software; you can redistribute it and/or modify it under
1284d9c625SLionel Sambuc the terms of the GNU General Public License as published by the Free
1384d9c625SLionel Sambuc Software Foundation; either version 3, or (at your option) any later
1484d9c625SLionel Sambuc version.
1584d9c625SLionel Sambuc 
1684d9c625SLionel Sambuc GCC is distributed in the hope that it will be useful, but WITHOUT ANY
1784d9c625SLionel Sambuc WARRANTY; without even the implied warranty of MERCHANTABILITY or
1884d9c625SLionel Sambuc FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1984d9c625SLionel Sambuc for more details.
2084d9c625SLionel Sambuc 
2184d9c625SLionel Sambuc Under Section 7 of GPL version 3, you are granted additional
2284d9c625SLionel Sambuc permissions described in the GCC Runtime Library Exception, version
2384d9c625SLionel Sambuc 3.1, as published by the Free Software Foundation.
2484d9c625SLionel Sambuc 
2584d9c625SLionel Sambuc You should have received a copy of the GNU General Public License and
2684d9c625SLionel Sambuc a copy of the GCC Runtime Library Exception along with this program;
2784d9c625SLionel Sambuc see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
2884d9c625SLionel Sambuc <http://www.gnu.org/licenses/>.  */
2984d9c625SLionel Sambuc 
3084d9c625SLionel Sambuc #ifndef _GLIBCXX_GCC_GTHR_H
3184d9c625SLionel Sambuc #define _GLIBCXX_GCC_GTHR_H
3284d9c625SLionel Sambuc 
3384d9c625SLionel Sambuc #ifndef _GLIBCXX_HIDE_EXPORTS
3484d9c625SLionel Sambuc #pragma GCC visibility push(default)
3584d9c625SLionel Sambuc #endif
3684d9c625SLionel Sambuc 
3784d9c625SLionel Sambuc /* If this file is compiled with threads support, it must
3884d9c625SLionel Sambuc        #define __GTHREADS 1
3984d9c625SLionel Sambuc    to indicate that threads support is present.  Also it has define
4084d9c625SLionel Sambuc    function
4184d9c625SLionel Sambuc      int __gthread_active_p ()
4284d9c625SLionel Sambuc    that returns 1 if thread system is active, 0 if not.
4384d9c625SLionel Sambuc 
4484d9c625SLionel Sambuc    The threads interface must define the following types:
4584d9c625SLionel Sambuc      __gthread_key_t
4684d9c625SLionel Sambuc      __gthread_once_t
4784d9c625SLionel Sambuc      __gthread_mutex_t
4884d9c625SLionel Sambuc      __gthread_recursive_mutex_t
4984d9c625SLionel Sambuc 
5084d9c625SLionel Sambuc    The threads interface must define the following macros:
5184d9c625SLionel Sambuc 
5284d9c625SLionel Sambuc      __GTHREAD_ONCE_INIT
5384d9c625SLionel Sambuc      		to initialize __gthread_once_t
5484d9c625SLionel Sambuc      __GTHREAD_MUTEX_INIT
5584d9c625SLionel Sambuc      		to initialize __gthread_mutex_t to get a fast
5684d9c625SLionel Sambuc 		non-recursive mutex.
5784d9c625SLionel 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:
6184d9c625SLionel 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.
6484d9c625SLionel Sambuc      __GTHREAD_RECURSIVE_MUTEX_INIT
6584d9c625SLionel Sambuc      __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
6684d9c625SLionel Sambuc      		as above, but for a recursive mutex.
6784d9c625SLionel Sambuc 
6884d9c625SLionel Sambuc    The threads interface must define the following static functions:
6984d9c625SLionel Sambuc 
7084d9c625SLionel Sambuc      int __gthread_once (__gthread_once_t *once, void (*func) ())
7184d9c625SLionel Sambuc 
7284d9c625SLionel Sambuc      int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
7384d9c625SLionel Sambuc      int __gthread_key_delete (__gthread_key_t key)
7484d9c625SLionel Sambuc 
7584d9c625SLionel Sambuc      void *__gthread_getspecific (__gthread_key_t key)
7684d9c625SLionel Sambuc      int __gthread_setspecific (__gthread_key_t key, const void *ptr)
7784d9c625SLionel Sambuc 
7884d9c625SLionel Sambuc      int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
79*0a6a1f1dSLionel Sambuc      int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex);
8084d9c625SLionel Sambuc 
8184d9c625SLionel Sambuc      int __gthread_mutex_lock (__gthread_mutex_t *mutex);
8284d9c625SLionel Sambuc      int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
8384d9c625SLionel Sambuc      int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
8484d9c625SLionel Sambuc 
8584d9c625SLionel Sambuc      int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
8684d9c625SLionel Sambuc      int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
8784d9c625SLionel Sambuc      int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
8884d9c625SLionel Sambuc 
8984d9c625SLionel Sambuc    The following are supported in POSIX threads only. They are required to
9084d9c625SLionel Sambuc    fix a deadlock in static initialization inside libsupc++. The header file
9184d9c625SLionel Sambuc    gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
9284d9c625SLionel Sambuc    features are supported.
9384d9c625SLionel Sambuc 
9484d9c625SLionel Sambuc    Types:
9584d9c625SLionel Sambuc      __gthread_cond_t
9684d9c625SLionel Sambuc 
9784d9c625SLionel Sambuc    Macros:
9884d9c625SLionel Sambuc      __GTHREAD_COND_INIT
9984d9c625SLionel Sambuc      __GTHREAD_COND_INIT_FUNCTION
10084d9c625SLionel Sambuc 
10184d9c625SLionel Sambuc    Interface:
10284d9c625SLionel Sambuc      int __gthread_cond_broadcast (__gthread_cond_t *cond);
10384d9c625SLionel Sambuc      int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
10484d9c625SLionel Sambuc      int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
10584d9c625SLionel Sambuc 					__gthread_recursive_mutex_t *mutex);
10684d9c625SLionel Sambuc 
10784d9c625SLionel Sambuc    All functions returning int should return zero on success or the error
10884d9c625SLionel Sambuc    number.  If the operation is not supported, -1 is returned.
10984d9c625SLionel Sambuc 
11084d9c625SLionel Sambuc    If the following are also defined, you should
11184d9c625SLionel Sambuc      #define __GTHREADS_CXX0X 1
11284d9c625SLionel Sambuc    to enable the c++0x thread library.
11384d9c625SLionel Sambuc 
11484d9c625SLionel Sambuc    Types:
11584d9c625SLionel Sambuc      __gthread_t
11684d9c625SLionel Sambuc      __gthread_time_t
11784d9c625SLionel Sambuc 
11884d9c625SLionel Sambuc    Interface:
11984d9c625SLionel Sambuc      int __gthread_create (__gthread_t *thread, void *(*func) (void*),
12084d9c625SLionel Sambuc                            void *args);
12184d9c625SLionel Sambuc      int __gthread_join (__gthread_t thread, void **value_ptr);
12284d9c625SLionel Sambuc      int __gthread_detach (__gthread_t thread);
12384d9c625SLionel Sambuc      int __gthread_equal (__gthread_t t1, __gthread_t t2);
12484d9c625SLionel Sambuc      __gthread_t __gthread_self (void);
12584d9c625SLionel Sambuc      int __gthread_yield (void);
12684d9c625SLionel Sambuc 
12784d9c625SLionel Sambuc      int __gthread_mutex_timedlock (__gthread_mutex_t *m,
12884d9c625SLionel Sambuc                                     const __gthread_time_t *abs_timeout);
12984d9c625SLionel Sambuc      int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
13084d9c625SLionel Sambuc                                           const __gthread_time_t *abs_time);
13184d9c625SLionel Sambuc 
13284d9c625SLionel Sambuc      int __gthread_cond_signal (__gthread_cond_t *cond);
13384d9c625SLionel Sambuc      int __gthread_cond_timedwait (__gthread_cond_t *cond,
13484d9c625SLionel Sambuc                                    __gthread_mutex_t *mutex,
13584d9c625SLionel Sambuc                                    const __gthread_time_t *abs_timeout);
13684d9c625SLionel Sambuc 
13784d9c625SLionel Sambuc */
13884d9c625SLionel Sambuc 
13984d9c625SLionel 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 
14884d9c625SLionel Sambuc #ifndef _GLIBCXX_GTHREAD_USE_WEAK
14984d9c625SLionel Sambuc #define _GLIBCXX_GTHREAD_USE_WEAK 1
15084d9c625SLionel Sambuc #endif
15184d9c625SLionel Sambuc #endif
15284d9c625SLionel Sambuc #include <bits/gthr-default.h>
15384d9c625SLionel Sambuc 
15484d9c625SLionel Sambuc #ifndef _GLIBCXX_HIDE_EXPORTS
15584d9c625SLionel Sambuc #pragma GCC visibility pop
15684d9c625SLionel Sambuc #endif
15784d9c625SLionel Sambuc 
15884d9c625SLionel Sambuc #endif /* ! _GLIBCXX_GCC_GTHR_H */
159