* lib/target-supports-dg.exp (check_test_flags): Delete.
[official-gcc.git] / libobjc / thr-objc.c
blob7d6375aaa55ec6bf8dcacfbf810becb3b21cf462
1 /* GNU Objective C Runtime Thread Interface.
2 Copyright (C) 1999, 2000, 2001, 2002, 2003, 2005, 2006
3 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under the
8 terms of the GNU General Public License as published by the Free Software
9 Foundation; either version 2, or (at your option) any later version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14 details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING. If not, write to
18 the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA. */
21 /* As a special exception, if you link this library with files compiled with
22 GCC to produce an executable, this does not cause the resulting executable
23 to be covered by the GNU General Public License. This exception does not
24 however invalidate any other reasons why the executable file might be
25 covered by the GNU General Public License. */
27 #define _LIBOBJC
28 /* The line below is needed for declarations of functions such as
29 pthread_mutexattr_settype, without which gthr-posix.h may fail to
30 compile within libobjc. Unfortunately, this breaks compilation on
31 Tru64 UNIX V4.0F, so disable it there. */
32 #ifndef __osf__
33 #define _XOPEN_SOURCE 500
34 #endif
35 #include "config.h"
36 #include "tconfig.h"
37 #include "coretypes.h"
38 #include "tm.h"
39 #include "defaults.h"
40 #include "objc/thr.h"
41 #include "objc/runtime.h"
42 #include <gthr.h>
44 /* Backend initialization functions */
46 /* Initialize the threads subsystem. */
47 int
48 __objc_init_thread_system(void)
50 return __gthread_objc_init_thread_system ();
53 /* Close the threads subsystem. */
54 int
55 __objc_close_thread_system(void)
57 return __gthread_objc_close_thread_system ();
60 /* Backend thread functions */
62 /* Create a new thread of execution. */
63 objc_thread_t
64 __objc_thread_detach(void (*func)(void *), void *arg)
66 return __gthread_objc_thread_detach (func, arg);
69 /* Set the current thread's priority. */
70 int
71 __objc_thread_set_priority(int priority)
73 return __gthread_objc_thread_set_priority (priority);
76 /* Return the current thread's priority. */
77 int
78 __objc_thread_get_priority(void)
80 return __gthread_objc_thread_get_priority ();
83 /* Yield our process time to another thread. */
84 void
85 __objc_thread_yield(void)
87 __gthread_objc_thread_yield ();
90 /* Terminate the current thread. */
91 int
92 __objc_thread_exit(void)
94 return __gthread_objc_thread_exit ();
97 /* Returns an integer value which uniquely describes a thread. */
98 objc_thread_t
99 __objc_thread_id(void)
101 return __gthread_objc_thread_id ();
104 /* Sets the thread's local storage pointer. */
106 __objc_thread_set_data(void *value)
108 return __gthread_objc_thread_set_data (value);
111 /* Returns the thread's local storage pointer. */
112 void *
113 __objc_thread_get_data(void)
115 return __gthread_objc_thread_get_data ();
118 /* Backend mutex functions */
120 /* Allocate a mutex. */
122 __objc_mutex_allocate(objc_mutex_t mutex)
124 return __gthread_objc_mutex_allocate (mutex);
127 /* Deallocate a mutex. */
129 __objc_mutex_deallocate(objc_mutex_t mutex)
131 return __gthread_objc_mutex_deallocate (mutex);
134 /* Grab a lock on a mutex. */
136 __objc_mutex_lock(objc_mutex_t mutex)
138 return __gthread_objc_mutex_lock (mutex);
141 /* Try to grab a lock on a mutex. */
143 __objc_mutex_trylock(objc_mutex_t mutex)
145 return __gthread_objc_mutex_trylock (mutex);
148 /* Unlock the mutex */
150 __objc_mutex_unlock(objc_mutex_t mutex)
152 return __gthread_objc_mutex_unlock (mutex);
155 /* Backend condition mutex functions */
157 /* Allocate a condition. */
159 __objc_condition_allocate(objc_condition_t condition)
161 return __gthread_objc_condition_allocate (condition);
164 /* Deallocate a condition. */
166 __objc_condition_deallocate(objc_condition_t condition)
168 return __gthread_objc_condition_deallocate (condition);
171 /* Wait on the condition */
173 __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
175 return __gthread_objc_condition_wait (condition, mutex);
178 /* Wake up all threads waiting on this condition. */
180 __objc_condition_broadcast(objc_condition_t condition)
182 return __gthread_objc_condition_broadcast (condition);
185 /* Wake up one thread waiting on this condition. */
187 __objc_condition_signal(objc_condition_t condition)
189 return __gthread_objc_condition_signal (condition);
192 /* End of File */