re PR target/8322 (SSE2 intrinsics broken?)
[official-gcc.git] / libobjc / thr-objc.c
blobf57073e844c6e40ba76b15a3aae6ddba0e721710
1 /* GNU Objective C Runtime Thread Interface.
2 Copyright (C) 1999 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 GNU CC 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 GNU CC 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 GNU CC; 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 "tconfig.h"
28 #include "coretypes.h"
29 #include "tm.h"
30 #include "defaults.h"
31 #include <objc/thr.h>
32 #include "runtime.h"
33 #include <gthr.h>
35 /* Backend initialization functions */
37 /* Initialize the threads subsystem. */
38 int
39 __objc_init_thread_system(void)
41 return __gthread_objc_init_thread_system ();
44 /* Close the threads subsystem. */
45 int
46 __objc_close_thread_system(void)
48 return __gthread_objc_close_thread_system ();
51 /* Backend thread functions */
53 /* Create a new thread of execution. */
54 objc_thread_t
55 __objc_thread_detach(void (*func)(void *), void *arg)
57 return __gthread_objc_thread_detach (func, arg);
60 /* Set the current thread's priority. */
61 int
62 __objc_thread_set_priority(int priority)
64 return __gthread_objc_thread_set_priority (priority);
67 /* Return the current thread's priority. */
68 int
69 __objc_thread_get_priority(void)
71 return __gthread_objc_thread_get_priority ();
74 /* Yield our process time to another thread. */
75 void
76 __objc_thread_yield(void)
78 __gthread_objc_thread_yield ();
81 /* Terminate the current thread. */
82 int
83 __objc_thread_exit(void)
85 return __gthread_objc_thread_exit ();
88 /* Returns an integer value which uniquely describes a thread. */
89 objc_thread_t
90 __objc_thread_id(void)
92 return __gthread_objc_thread_id ();
95 /* Sets the thread's local storage pointer. */
96 int
97 __objc_thread_set_data(void *value)
99 return __gthread_objc_thread_set_data (value);
102 /* Returns the thread's local storage pointer. */
103 void *
104 __objc_thread_get_data(void)
106 return __gthread_objc_thread_get_data ();
109 /* Backend mutex functions */
111 /* Allocate a mutex. */
113 __objc_mutex_allocate(objc_mutex_t mutex)
115 return __gthread_objc_mutex_allocate (mutex);
118 /* Deallocate a mutex. */
120 __objc_mutex_deallocate(objc_mutex_t mutex)
122 return __gthread_objc_mutex_deallocate (mutex);
125 /* Grab a lock on a mutex. */
127 __objc_mutex_lock(objc_mutex_t mutex)
129 return __gthread_objc_mutex_lock (mutex);
132 /* Try to grab a lock on a mutex. */
134 __objc_mutex_trylock(objc_mutex_t mutex)
136 return __gthread_objc_mutex_trylock (mutex);
139 /* Unlock the mutex */
141 __objc_mutex_unlock(objc_mutex_t mutex)
143 return __gthread_objc_mutex_unlock (mutex);
146 /* Backend condition mutex functions */
148 /* Allocate a condition. */
150 __objc_condition_allocate(objc_condition_t condition)
152 return __gthread_objc_condition_allocate (condition);
155 /* Deallocate a condition. */
157 __objc_condition_deallocate(objc_condition_t condition)
159 return __gthread_objc_condition_deallocate (condition);
162 /* Wait on the condition */
164 __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
166 return __gthread_objc_condition_wait (condition, mutex);
169 /* Wake up all threads waiting on this condition. */
171 __objc_condition_broadcast(objc_condition_t condition)
173 return __gthread_objc_condition_broadcast (condition);
176 /* Wake up one thread waiting on this condition. */
178 __objc_condition_signal(objc_condition_t condition)
180 return __gthread_objc_condition_signal (condition);
183 /* End of File */