* configure.ac (target_header_dir): vfork is a stub under djgpp.
[official-gcc.git] / libobjc / thr-objc.c
blobd954f937154619e2483bcab91c2fa167ebc29d94
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, 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, 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 #include "config.h"
28 #include "tconfig.h"
29 #include "coretypes.h"
30 #include "tm.h"
31 #include "defaults.h"
32 #include <objc/thr.h>
33 #include "runtime.h"
34 #include <gthr.h>
36 /* Backend initialization functions */
38 /* Initialize the threads subsystem. */
39 int
40 __objc_init_thread_system(void)
42 return __gthread_objc_init_thread_system ();
45 /* Close the threads subsystem. */
46 int
47 __objc_close_thread_system(void)
49 return __gthread_objc_close_thread_system ();
52 /* Backend thread functions */
54 /* Create a new thread of execution. */
55 objc_thread_t
56 __objc_thread_detach(void (*func)(void *), void *arg)
58 return __gthread_objc_thread_detach (func, arg);
61 /* Set the current thread's priority. */
62 int
63 __objc_thread_set_priority(int priority)
65 return __gthread_objc_thread_set_priority (priority);
68 /* Return the current thread's priority. */
69 int
70 __objc_thread_get_priority(void)
72 return __gthread_objc_thread_get_priority ();
75 /* Yield our process time to another thread. */
76 void
77 __objc_thread_yield(void)
79 __gthread_objc_thread_yield ();
82 /* Terminate the current thread. */
83 int
84 __objc_thread_exit(void)
86 return __gthread_objc_thread_exit ();
89 /* Returns an integer value which uniquely describes a thread. */
90 objc_thread_t
91 __objc_thread_id(void)
93 return __gthread_objc_thread_id ();
96 /* Sets the thread's local storage pointer. */
97 int
98 __objc_thread_set_data(void *value)
100 return __gthread_objc_thread_set_data (value);
103 /* Returns the thread's local storage pointer. */
104 void *
105 __objc_thread_get_data(void)
107 return __gthread_objc_thread_get_data ();
110 /* Backend mutex functions */
112 /* Allocate a mutex. */
114 __objc_mutex_allocate(objc_mutex_t mutex)
116 return __gthread_objc_mutex_allocate (mutex);
119 /* Deallocate a mutex. */
121 __objc_mutex_deallocate(objc_mutex_t mutex)
123 return __gthread_objc_mutex_deallocate (mutex);
126 /* Grab a lock on a mutex. */
128 __objc_mutex_lock(objc_mutex_t mutex)
130 return __gthread_objc_mutex_lock (mutex);
133 /* Try to grab a lock on a mutex. */
135 __objc_mutex_trylock(objc_mutex_t mutex)
137 return __gthread_objc_mutex_trylock (mutex);
140 /* Unlock the mutex */
142 __objc_mutex_unlock(objc_mutex_t mutex)
144 return __gthread_objc_mutex_unlock (mutex);
147 /* Backend condition mutex functions */
149 /* Allocate a condition. */
151 __objc_condition_allocate(objc_condition_t condition)
153 return __gthread_objc_condition_allocate (condition);
156 /* Deallocate a condition. */
158 __objc_condition_deallocate(objc_condition_t condition)
160 return __gthread_objc_condition_deallocate (condition);
163 /* Wait on the condition */
165 __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
167 return __gthread_objc_condition_wait (condition, mutex);
170 /* Wake up all threads waiting on this condition. */
172 __objc_condition_broadcast(objc_condition_t condition)
174 return __gthread_objc_condition_broadcast (condition);
177 /* Wake up one thread waiting on this condition. */
179 __objc_condition_signal(objc_condition_t condition)
181 return __gthread_objc_condition_signal (condition);
184 /* End of File */