source: trunk/third/gcc/libobjc/thr-objc.c @ 21199

Revision 21199, 4.1 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21198, which included commits to RCS files with non-trunk default branches.
Line 
1/* GNU Objective C Runtime Thread Interface.
2   Copyright (C) 1999 Free Software Foundation, Inc.
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under the
7terms of the GNU General Public License as published by the Free Software
8Foundation; either version 2, or (at your option) any later version.
9
10GCC is distributed in the hope that it will be useful, but WITHOUT ANY
11WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
13details.
14
15You should have received a copy of the GNU General Public License
16along with GCC; see the file COPYING.  If not, write to
17the Free Software Foundation, 59 Temple Place - Suite 330,
18Boston, MA 02111-1307, USA.  */
19
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.  */
25
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>
34
35/* Backend initialization functions */
36
37/* Initialize the threads subsystem. */
38int
39__objc_init_thread_system(void)
40{
41  return __gthread_objc_init_thread_system ();
42}
43
44/* Close the threads subsystem. */
45int
46__objc_close_thread_system(void)
47{
48  return __gthread_objc_close_thread_system ();
49}
50
51/* Backend thread functions */
52
53/* Create a new thread of execution. */
54objc_thread_t
55__objc_thread_detach(void (*func)(void *), void *arg)
56{
57  return __gthread_objc_thread_detach (func, arg);
58}
59
60/* Set the current thread's priority. */
61int
62__objc_thread_set_priority(int priority)
63{
64  return __gthread_objc_thread_set_priority (priority);
65}
66
67/* Return the current thread's priority. */
68int
69__objc_thread_get_priority(void)
70{
71  return __gthread_objc_thread_get_priority ();
72}
73
74/* Yield our process time to another thread. */
75void
76__objc_thread_yield(void)
77{
78  __gthread_objc_thread_yield ();
79}
80
81/* Terminate the current thread. */
82int
83__objc_thread_exit(void)
84{
85  return __gthread_objc_thread_exit ();
86}
87
88/* Returns an integer value which uniquely describes a thread. */
89objc_thread_t
90__objc_thread_id(void)
91{
92  return __gthread_objc_thread_id ();
93}
94
95/* Sets the thread's local storage pointer. */
96int
97__objc_thread_set_data(void *value)
98{
99  return __gthread_objc_thread_set_data (value);
100}
101
102/* Returns the thread's local storage pointer. */
103void *
104__objc_thread_get_data(void)
105{
106  return __gthread_objc_thread_get_data ();
107}
108
109/* Backend mutex functions */
110
111/* Allocate a mutex. */
112int
113__objc_mutex_allocate(objc_mutex_t mutex)
114{
115  return __gthread_objc_mutex_allocate (mutex);
116}
117
118/* Deallocate a mutex. */
119int
120__objc_mutex_deallocate(objc_mutex_t mutex)
121{
122  return __gthread_objc_mutex_deallocate (mutex);
123}
124
125/* Grab a lock on a mutex. */
126int
127__objc_mutex_lock(objc_mutex_t mutex)
128{
129  return __gthread_objc_mutex_lock (mutex);
130}
131
132/* Try to grab a lock on a mutex. */
133int
134__objc_mutex_trylock(objc_mutex_t mutex)
135{
136  return __gthread_objc_mutex_trylock (mutex);
137}
138
139/* Unlock the mutex */
140int
141__objc_mutex_unlock(objc_mutex_t mutex)
142{
143  return __gthread_objc_mutex_unlock (mutex);
144}
145
146/* Backend condition mutex functions */
147
148/* Allocate a condition. */
149int
150__objc_condition_allocate(objc_condition_t condition)
151{
152  return __gthread_objc_condition_allocate (condition);
153}
154
155/* Deallocate a condition. */
156int
157__objc_condition_deallocate(objc_condition_t condition)
158{
159  return __gthread_objc_condition_deallocate (condition);
160}
161
162/* Wait on the condition */
163int
164__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
165{
166  return __gthread_objc_condition_wait (condition, mutex);
167}
168
169/* Wake up all threads waiting on this condition. */
170int
171__objc_condition_broadcast(objc_condition_t condition)
172{
173  return __gthread_objc_condition_broadcast (condition);
174}
175
176/* Wake up one thread waiting on this condition. */
177int
178__objc_condition_signal(objc_condition_t condition)
179{
180  return __gthread_objc_condition_signal (condition);
181}
182
183/* End of File */
Note: See TracBrowser for help on using the repository browser.