xref: /minix3/external/gpl3/gcc/lib/libstdc++-v3/arch/earmv7/gthr-single.h (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc /* This file is automatically generated.  DO NOT EDIT! */
2*84d9c625SLionel Sambuc /* Generated from: 	NetBSD: mknative-gcc,v 1.66 2012/01/10 12:27:54 skrll Exp  */
3*84d9c625SLionel Sambuc /* Generated from: NetBSD: mknative.common,v 1.9 2007/02/05 18:26:01 apb Exp  */
4*84d9c625SLionel Sambuc 
5*84d9c625SLionel Sambuc /* Threads compatibility routines for libgcc2 and libobjc.  */
6*84d9c625SLionel Sambuc /* Compile this one with gcc.  */
7*84d9c625SLionel Sambuc /* Copyright (C) 1997, 1999, 2000, 2004, 2008, 2009
8*84d9c625SLionel Sambuc    Free Software Foundation, Inc.
9*84d9c625SLionel Sambuc 
10*84d9c625SLionel Sambuc This file is part of GCC.
11*84d9c625SLionel Sambuc 
12*84d9c625SLionel Sambuc GCC is free software; you can redistribute it and/or modify it under
13*84d9c625SLionel Sambuc the terms of the GNU General Public License as published by the Free
14*84d9c625SLionel Sambuc Software Foundation; either version 3, or (at your option) any later
15*84d9c625SLionel Sambuc version.
16*84d9c625SLionel Sambuc 
17*84d9c625SLionel Sambuc GCC is distributed in the hope that it will be useful, but WITHOUT ANY
18*84d9c625SLionel Sambuc WARRANTY; without even the implied warranty of MERCHANTABILITY or
19*84d9c625SLionel Sambuc FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20*84d9c625SLionel Sambuc for more details.
21*84d9c625SLionel Sambuc 
22*84d9c625SLionel Sambuc Under Section 7 of GPL version 3, you are granted additional
23*84d9c625SLionel Sambuc permissions described in the GCC Runtime Library Exception, version
24*84d9c625SLionel Sambuc 3.1, as published by the Free Software Foundation.
25*84d9c625SLionel Sambuc 
26*84d9c625SLionel Sambuc You should have received a copy of the GNU General Public License and
27*84d9c625SLionel Sambuc a copy of the GCC Runtime Library Exception along with this program;
28*84d9c625SLionel Sambuc see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
29*84d9c625SLionel Sambuc <http://www.gnu.org/licenses/>.  */
30*84d9c625SLionel Sambuc 
31*84d9c625SLionel Sambuc #ifndef _GLIBCXX_GCC_GTHR_SINGLE_H
32*84d9c625SLionel Sambuc #define _GLIBCXX_GCC_GTHR_SINGLE_H
33*84d9c625SLionel Sambuc 
34*84d9c625SLionel Sambuc /* Just provide compatibility for mutex handling.  */
35*84d9c625SLionel Sambuc 
36*84d9c625SLionel Sambuc typedef int __gthread_key_t;
37*84d9c625SLionel Sambuc typedef int __gthread_once_t;
38*84d9c625SLionel Sambuc typedef int __gthread_mutex_t;
39*84d9c625SLionel Sambuc typedef int __gthread_recursive_mutex_t;
40*84d9c625SLionel Sambuc 
41*84d9c625SLionel Sambuc #define __GTHREAD_ONCE_INIT 0
42*84d9c625SLionel Sambuc #define __GTHREAD_MUTEX_INIT 0
43*84d9c625SLionel Sambuc #define __GTHREAD_RECURSIVE_MUTEX_INIT 0
44*84d9c625SLionel Sambuc 
45*84d9c625SLionel Sambuc #define _GLIBCXX_UNUSED __attribute__((unused))
46*84d9c625SLionel Sambuc 
47*84d9c625SLionel Sambuc #ifdef _LIBOBJC
48*84d9c625SLionel Sambuc 
49*84d9c625SLionel Sambuc /* Thread local storage for a single thread */
50*84d9c625SLionel Sambuc static void *thread_local_storage = NULL;
51*84d9c625SLionel Sambuc 
52*84d9c625SLionel Sambuc /* Backend initialization functions */
53*84d9c625SLionel Sambuc 
54*84d9c625SLionel Sambuc /* Initialize the threads subsystem.  */
55*84d9c625SLionel Sambuc static inline int
56*84d9c625SLionel Sambuc __gthread_objc_init_thread_system (void)
57*84d9c625SLionel Sambuc {
58*84d9c625SLionel Sambuc   /* No thread support available */
59*84d9c625SLionel Sambuc   return -1;
60*84d9c625SLionel Sambuc }
61*84d9c625SLionel Sambuc 
62*84d9c625SLionel Sambuc /* Close the threads subsystem.  */
63*84d9c625SLionel Sambuc static inline int
64*84d9c625SLionel Sambuc __gthread_objc_close_thread_system (void)
65*84d9c625SLionel Sambuc {
66*84d9c625SLionel Sambuc   /* No thread support available */
67*84d9c625SLionel Sambuc   return -1;
68*84d9c625SLionel Sambuc }
69*84d9c625SLionel Sambuc 
70*84d9c625SLionel Sambuc /* Backend thread functions */
71*84d9c625SLionel Sambuc 
72*84d9c625SLionel Sambuc /* Create a new thread of execution.  */
73*84d9c625SLionel Sambuc static inline objc_thread_t
74*84d9c625SLionel Sambuc __gthread_objc_thread_detach (void (* func)(void *), void * arg _GLIBCXX_UNUSED)
75*84d9c625SLionel Sambuc {
76*84d9c625SLionel Sambuc   /* No thread support available */
77*84d9c625SLionel Sambuc   return NULL;
78*84d9c625SLionel Sambuc }
79*84d9c625SLionel Sambuc 
80*84d9c625SLionel Sambuc /* Set the current thread's priority.  */
81*84d9c625SLionel Sambuc static inline int
82*84d9c625SLionel Sambuc __gthread_objc_thread_set_priority (int priority _GLIBCXX_UNUSED)
83*84d9c625SLionel Sambuc {
84*84d9c625SLionel Sambuc   /* No thread support available */
85*84d9c625SLionel Sambuc   return -1;
86*84d9c625SLionel Sambuc }
87*84d9c625SLionel Sambuc 
88*84d9c625SLionel Sambuc /* Return the current thread's priority.  */
89*84d9c625SLionel Sambuc static inline int
90*84d9c625SLionel Sambuc __gthread_objc_thread_get_priority (void)
91*84d9c625SLionel Sambuc {
92*84d9c625SLionel Sambuc   return OBJC_THREAD_INTERACTIVE_PRIORITY;
93*84d9c625SLionel Sambuc }
94*84d9c625SLionel Sambuc 
95*84d9c625SLionel Sambuc /* Yield our process time to another thread.  */
96*84d9c625SLionel Sambuc static inline void
97*84d9c625SLionel Sambuc __gthread_objc_thread_yield (void)
98*84d9c625SLionel Sambuc {
99*84d9c625SLionel Sambuc   return;
100*84d9c625SLionel Sambuc }
101*84d9c625SLionel Sambuc 
102*84d9c625SLionel Sambuc /* Terminate the current thread.  */
103*84d9c625SLionel Sambuc static inline int
104*84d9c625SLionel Sambuc __gthread_objc_thread_exit (void)
105*84d9c625SLionel Sambuc {
106*84d9c625SLionel Sambuc   /* No thread support available */
107*84d9c625SLionel Sambuc   /* Should we really exit the program */
108*84d9c625SLionel Sambuc   /* exit (&__objc_thread_exit_status); */
109*84d9c625SLionel Sambuc   return -1;
110*84d9c625SLionel Sambuc }
111*84d9c625SLionel Sambuc 
112*84d9c625SLionel Sambuc /* Returns an integer value which uniquely describes a thread.  */
113*84d9c625SLionel Sambuc static inline objc_thread_t
114*84d9c625SLionel Sambuc __gthread_objc_thread_id (void)
115*84d9c625SLionel Sambuc {
116*84d9c625SLionel Sambuc   /* No thread support, use 1.  */
117*84d9c625SLionel Sambuc   return (objc_thread_t) 1;
118*84d9c625SLionel Sambuc }
119*84d9c625SLionel Sambuc 
120*84d9c625SLionel Sambuc /* Sets the thread's local storage pointer.  */
121*84d9c625SLionel Sambuc static inline int
122*84d9c625SLionel Sambuc __gthread_objc_thread_set_data (void *value)
123*84d9c625SLionel Sambuc {
124*84d9c625SLionel Sambuc   thread_local_storage = value;
125*84d9c625SLionel Sambuc   return 0;
126*84d9c625SLionel Sambuc }
127*84d9c625SLionel Sambuc 
128*84d9c625SLionel Sambuc /* Returns the thread's local storage pointer.  */
129*84d9c625SLionel Sambuc static inline void *
130*84d9c625SLionel Sambuc __gthread_objc_thread_get_data (void)
131*84d9c625SLionel Sambuc {
132*84d9c625SLionel Sambuc   return thread_local_storage;
133*84d9c625SLionel Sambuc }
134*84d9c625SLionel Sambuc 
135*84d9c625SLionel Sambuc /* Backend mutex functions */
136*84d9c625SLionel Sambuc 
137*84d9c625SLionel Sambuc /* Allocate a mutex.  */
138*84d9c625SLionel Sambuc static inline int
139*84d9c625SLionel Sambuc __gthread_objc_mutex_allocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
140*84d9c625SLionel Sambuc {
141*84d9c625SLionel Sambuc   return 0;
142*84d9c625SLionel Sambuc }
143*84d9c625SLionel Sambuc 
144*84d9c625SLionel Sambuc /* Deallocate a mutex.  */
145*84d9c625SLionel Sambuc static inline int
146*84d9c625SLionel Sambuc __gthread_objc_mutex_deallocate (objc_mutex_t mutex _GLIBCXX_UNUSED)
147*84d9c625SLionel Sambuc {
148*84d9c625SLionel Sambuc   return 0;
149*84d9c625SLionel Sambuc }
150*84d9c625SLionel Sambuc 
151*84d9c625SLionel Sambuc /* Grab a lock on a mutex.  */
152*84d9c625SLionel Sambuc static inline int
153*84d9c625SLionel Sambuc __gthread_objc_mutex_lock (objc_mutex_t mutex _GLIBCXX_UNUSED)
154*84d9c625SLionel Sambuc {
155*84d9c625SLionel Sambuc   /* There can only be one thread, so we always get the lock */
156*84d9c625SLionel Sambuc   return 0;
157*84d9c625SLionel Sambuc }
158*84d9c625SLionel Sambuc 
159*84d9c625SLionel Sambuc /* Try to grab a lock on a mutex.  */
160*84d9c625SLionel Sambuc static inline int
161*84d9c625SLionel Sambuc __gthread_objc_mutex_trylock (objc_mutex_t mutex _GLIBCXX_UNUSED)
162*84d9c625SLionel Sambuc {
163*84d9c625SLionel Sambuc   /* There can only be one thread, so we always get the lock */
164*84d9c625SLionel Sambuc   return 0;
165*84d9c625SLionel Sambuc }
166*84d9c625SLionel Sambuc 
167*84d9c625SLionel Sambuc /* Unlock the mutex */
168*84d9c625SLionel Sambuc static inline int
169*84d9c625SLionel Sambuc __gthread_objc_mutex_unlock (objc_mutex_t mutex _GLIBCXX_UNUSED)
170*84d9c625SLionel Sambuc {
171*84d9c625SLionel Sambuc   return 0;
172*84d9c625SLionel Sambuc }
173*84d9c625SLionel Sambuc 
174*84d9c625SLionel Sambuc /* Backend condition mutex functions */
175*84d9c625SLionel Sambuc 
176*84d9c625SLionel Sambuc /* Allocate a condition.  */
177*84d9c625SLionel Sambuc static inline int
178*84d9c625SLionel Sambuc __gthread_objc_condition_allocate (objc_condition_t condition _GLIBCXX_UNUSED)
179*84d9c625SLionel Sambuc {
180*84d9c625SLionel Sambuc   return 0;
181*84d9c625SLionel Sambuc }
182*84d9c625SLionel Sambuc 
183*84d9c625SLionel Sambuc /* Deallocate a condition.  */
184*84d9c625SLionel Sambuc static inline int
185*84d9c625SLionel Sambuc __gthread_objc_condition_deallocate (objc_condition_t condition _GLIBCXX_UNUSED)
186*84d9c625SLionel Sambuc {
187*84d9c625SLionel Sambuc   return 0;
188*84d9c625SLionel Sambuc }
189*84d9c625SLionel Sambuc 
190*84d9c625SLionel Sambuc /* Wait on the condition */
191*84d9c625SLionel Sambuc static inline int
192*84d9c625SLionel Sambuc __gthread_objc_condition_wait (objc_condition_t condition _GLIBCXX_UNUSED,
193*84d9c625SLionel Sambuc 			       objc_mutex_t mutex _GLIBCXX_UNUSED)
194*84d9c625SLionel Sambuc {
195*84d9c625SLionel Sambuc   return 0;
196*84d9c625SLionel Sambuc }
197*84d9c625SLionel Sambuc 
198*84d9c625SLionel Sambuc /* Wake up all threads waiting on this condition.  */
199*84d9c625SLionel Sambuc static inline int
200*84d9c625SLionel Sambuc __gthread_objc_condition_broadcast (objc_condition_t condition _GLIBCXX_UNUSED)
201*84d9c625SLionel Sambuc {
202*84d9c625SLionel Sambuc   return 0;
203*84d9c625SLionel Sambuc }
204*84d9c625SLionel Sambuc 
205*84d9c625SLionel Sambuc /* Wake up one thread waiting on this condition.  */
206*84d9c625SLionel Sambuc static inline int
207*84d9c625SLionel Sambuc __gthread_objc_condition_signal (objc_condition_t condition _GLIBCXX_UNUSED)
208*84d9c625SLionel Sambuc {
209*84d9c625SLionel Sambuc   return 0;
210*84d9c625SLionel Sambuc }
211*84d9c625SLionel Sambuc 
212*84d9c625SLionel Sambuc #else /* _LIBOBJC */
213*84d9c625SLionel Sambuc 
214*84d9c625SLionel Sambuc static inline int
215*84d9c625SLionel Sambuc __gthread_active_p (void)
216*84d9c625SLionel Sambuc {
217*84d9c625SLionel Sambuc   return 0;
218*84d9c625SLionel Sambuc }
219*84d9c625SLionel Sambuc 
220*84d9c625SLionel Sambuc static inline int
221*84d9c625SLionel Sambuc __gthread_once (__gthread_once_t *__once _GLIBCXX_UNUSED, void (*__func) (void) _GLIBCXX_UNUSED)
222*84d9c625SLionel Sambuc {
223*84d9c625SLionel Sambuc   return 0;
224*84d9c625SLionel Sambuc }
225*84d9c625SLionel Sambuc 
226*84d9c625SLionel Sambuc static inline int _GLIBCXX_UNUSED
227*84d9c625SLionel Sambuc __gthread_key_create (__gthread_key_t *__key _GLIBCXX_UNUSED, void (*__func) (void *) _GLIBCXX_UNUSED)
228*84d9c625SLionel Sambuc {
229*84d9c625SLionel Sambuc   return 0;
230*84d9c625SLionel Sambuc }
231*84d9c625SLionel Sambuc 
232*84d9c625SLionel Sambuc static int _GLIBCXX_UNUSED
233*84d9c625SLionel Sambuc __gthread_key_delete (__gthread_key_t __key _GLIBCXX_UNUSED)
234*84d9c625SLionel Sambuc {
235*84d9c625SLionel Sambuc   return 0;
236*84d9c625SLionel Sambuc }
237*84d9c625SLionel Sambuc 
238*84d9c625SLionel Sambuc static inline void *
239*84d9c625SLionel Sambuc __gthread_getspecific (__gthread_key_t __key _GLIBCXX_UNUSED)
240*84d9c625SLionel Sambuc {
241*84d9c625SLionel Sambuc   return 0;
242*84d9c625SLionel Sambuc }
243*84d9c625SLionel Sambuc 
244*84d9c625SLionel Sambuc static inline int
245*84d9c625SLionel Sambuc __gthread_setspecific (__gthread_key_t __key _GLIBCXX_UNUSED, const void *__v _GLIBCXX_UNUSED)
246*84d9c625SLionel Sambuc {
247*84d9c625SLionel Sambuc   return 0;
248*84d9c625SLionel Sambuc }
249*84d9c625SLionel Sambuc 
250*84d9c625SLionel Sambuc static inline int
251*84d9c625SLionel Sambuc __gthread_mutex_destroy (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
252*84d9c625SLionel Sambuc {
253*84d9c625SLionel Sambuc   return 0;
254*84d9c625SLionel Sambuc }
255*84d9c625SLionel Sambuc 
256*84d9c625SLionel Sambuc static inline int
257*84d9c625SLionel Sambuc __gthread_mutex_lock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
258*84d9c625SLionel Sambuc {
259*84d9c625SLionel Sambuc   return 0;
260*84d9c625SLionel Sambuc }
261*84d9c625SLionel Sambuc 
262*84d9c625SLionel Sambuc static inline int
263*84d9c625SLionel Sambuc __gthread_mutex_trylock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
264*84d9c625SLionel Sambuc {
265*84d9c625SLionel Sambuc   return 0;
266*84d9c625SLionel Sambuc }
267*84d9c625SLionel Sambuc 
268*84d9c625SLionel Sambuc static inline int
269*84d9c625SLionel Sambuc __gthread_mutex_unlock (__gthread_mutex_t *__mutex _GLIBCXX_UNUSED)
270*84d9c625SLionel Sambuc {
271*84d9c625SLionel Sambuc   return 0;
272*84d9c625SLionel Sambuc }
273*84d9c625SLionel Sambuc 
274*84d9c625SLionel Sambuc static inline int
275*84d9c625SLionel Sambuc __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
276*84d9c625SLionel Sambuc {
277*84d9c625SLionel Sambuc   return __gthread_mutex_lock (__mutex);
278*84d9c625SLionel Sambuc }
279*84d9c625SLionel Sambuc 
280*84d9c625SLionel Sambuc static inline int
281*84d9c625SLionel Sambuc __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
282*84d9c625SLionel Sambuc {
283*84d9c625SLionel Sambuc   return __gthread_mutex_trylock (__mutex);
284*84d9c625SLionel Sambuc }
285*84d9c625SLionel Sambuc 
286*84d9c625SLionel Sambuc static inline int
287*84d9c625SLionel Sambuc __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
288*84d9c625SLionel Sambuc {
289*84d9c625SLionel Sambuc   return __gthread_mutex_unlock (__mutex);
290*84d9c625SLionel Sambuc }
291*84d9c625SLionel Sambuc 
292*84d9c625SLionel Sambuc #endif /* _LIBOBJC */
293*84d9c625SLionel Sambuc 
294*84d9c625SLionel Sambuc #undef _GLIBCXX_UNUSED
295*84d9c625SLionel Sambuc 
296*84d9c625SLionel Sambuc #endif /* ! _GLIBCXX_GCC_GTHR_SINGLE_H */
297