* config/arm/bpabi.h (SUBTARGET_EXTRA_ASM_SPEC): Pass -meabi=gnu for
[official-gcc.git] / libobjc / thr-objc.c
bloba859e1eb0fb58f1146219824567594e10327b9b4
1 /* GNU Objective C Runtime Thread Interface.
2 Copyright (C) 1999 Free Software Foundation, Inc.
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under the
7 terms of the GNU General Public License as published by the Free Software
8 Foundation; either version 2, or (at your option) any later version.
10 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 details.
15 You should have received a copy of the GNU General Public License
16 along with GCC; see the file COPYING. If not, write to
17 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA. */
20 /* As a special exception, if you link this library with files compiled with
21 GCC to produce an executable, this does not cause the resulting executable
22 to be covered by the GNU General Public License. This exception does not
23 however invalidate any other reasons why the executable file might be
24 covered by the GNU General Public License. */
26 #define _LIBOBJC
27 /* The line below is needed for declarations of functions such as
28 pthread_mutexattr_settype, without which gthr-posix.h may fail to
29 compile within libobjc. */
30 #define _XOPEN_SOURCE 500
31 #include "config.h"
32 #include "tconfig.h"
33 #include "coretypes.h"
34 #include "tm.h"
35 #include "defaults.h"
36 #include "objc/thr.h"
37 #include "objc/runtime.h"
38 #include <gthr.h>
40 /* Backend initialization functions */
42 /* Initialize the threads subsystem. */
43 int
44 __objc_init_thread_system(void)
46 return __gthread_objc_init_thread_system ();
49 /* Close the threads subsystem. */
50 int
51 __objc_close_thread_system(void)
53 return __gthread_objc_close_thread_system ();
56 /* Backend thread functions */
58 /* Create a new thread of execution. */
59 objc_thread_t
60 __objc_thread_detach(void (*func)(void *), void *arg)
62 return __gthread_objc_thread_detach (func, arg);
65 /* Set the current thread's priority. */
66 int
67 __objc_thread_set_priority(int priority)
69 return __gthread_objc_thread_set_priority (priority);
72 /* Return the current thread's priority. */
73 int
74 __objc_thread_get_priority(void)
76 return __gthread_objc_thread_get_priority ();
79 /* Yield our process time to another thread. */
80 void
81 __objc_thread_yield(void)
83 __gthread_objc_thread_yield ();
86 /* Terminate the current thread. */
87 int
88 __objc_thread_exit(void)
90 return __gthread_objc_thread_exit ();
93 /* Returns an integer value which uniquely describes a thread. */
94 objc_thread_t
95 __objc_thread_id(void)
97 return __gthread_objc_thread_id ();
100 /* Sets the thread's local storage pointer. */
102 __objc_thread_set_data(void *value)
104 return __gthread_objc_thread_set_data (value);
107 /* Returns the thread's local storage pointer. */
108 void *
109 __objc_thread_get_data(void)
111 return __gthread_objc_thread_get_data ();
114 /* Backend mutex functions */
116 /* Allocate a mutex. */
118 __objc_mutex_allocate(objc_mutex_t mutex)
120 return __gthread_objc_mutex_allocate (mutex);
123 /* Deallocate a mutex. */
125 __objc_mutex_deallocate(objc_mutex_t mutex)
127 return __gthread_objc_mutex_deallocate (mutex);
130 /* Grab a lock on a mutex. */
132 __objc_mutex_lock(objc_mutex_t mutex)
134 return __gthread_objc_mutex_lock (mutex);
137 /* Try to grab a lock on a mutex. */
139 __objc_mutex_trylock(objc_mutex_t mutex)
141 return __gthread_objc_mutex_trylock (mutex);
144 /* Unlock the mutex */
146 __objc_mutex_unlock(objc_mutex_t mutex)
148 return __gthread_objc_mutex_unlock (mutex);
151 /* Backend condition mutex functions */
153 /* Allocate a condition. */
155 __objc_condition_allocate(objc_condition_t condition)
157 return __gthread_objc_condition_allocate (condition);
160 /* Deallocate a condition. */
162 __objc_condition_deallocate(objc_condition_t condition)
164 return __gthread_objc_condition_deallocate (condition);
167 /* Wait on the condition */
169 __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
171 return __gthread_objc_condition_wait (condition, mutex);
174 /* Wake up all threads waiting on this condition. */
176 __objc_condition_broadcast(objc_condition_t condition)
178 return __gthread_objc_condition_broadcast (condition);
181 /* Wake up one thread waiting on this condition. */
183 __objc_condition_signal(objc_condition_t condition)
185 return __gthread_objc_condition_signal (condition);
188 /* End of File */