source: vendor/gcc/3.2.2/libobjc/thr-objc.c

Last change on this file was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 4.1 KB
Line 
1/* GNU Objective C Runtime Thread Interface.
2 Copyright (C) 1999 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC 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
10GNU CC 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 GNU CC; 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 "defaults.h"
29#include <objc/thr.h>
30#include "runtime.h"
31#include <gthr.h>
32
33/* Backend initialization functions */
34
35/* Initialize the threads subsystem. */
36int
37__objc_init_thread_system(void)
38{
39 return __gthread_objc_init_thread_system ();
40}
41
42/* Close the threads subsystem. */
43int
44__objc_close_thread_system(void)
45{
46 return __gthread_objc_close_thread_system ();
47}
48
49/* Backend thread functions */
50
51/* Create a new thread of execution. */
52objc_thread_t
53__objc_thread_detach(void (*func)(void *), void *arg)
54{
55 return __gthread_objc_thread_detach (func, arg);
56}
57
58/* Set the current thread's priority. */
59int
60__objc_thread_set_priority(int priority)
61{
62 return __gthread_objc_thread_set_priority (priority);
63}
64
65/* Return the current thread's priority. */
66int
67__objc_thread_get_priority(void)
68{
69 return __gthread_objc_thread_get_priority ();
70}
71
72/* Yield our process time to another thread. */
73void
74__objc_thread_yield(void)
75{
76 __gthread_objc_thread_yield ();
77}
78
79/* Terminate the current thread. */
80int
81__objc_thread_exit(void)
82{
83 return __gthread_objc_thread_exit ();
84}
85
86/* Returns an integer value which uniquely describes a thread. */
87objc_thread_t
88__objc_thread_id(void)
89{
90 return __gthread_objc_thread_id ();
91}
92
93/* Sets the thread's local storage pointer. */
94int
95__objc_thread_set_data(void *value)
96{
97 return __gthread_objc_thread_set_data (value);
98}
99
100/* Returns the thread's local storage pointer. */
101void *
102__objc_thread_get_data(void)
103{
104 return __gthread_objc_thread_get_data ();
105}
106
107/* Backend mutex functions */
108
109/* Allocate a mutex. */
110int
111__objc_mutex_allocate(objc_mutex_t mutex)
112{
113 return __gthread_objc_mutex_allocate (mutex);
114}
115
116/* Deallocate a mutex. */
117int
118__objc_mutex_deallocate(objc_mutex_t mutex)
119{
120 return __gthread_objc_mutex_deallocate (mutex);
121}
122
123/* Grab a lock on a mutex. */
124int
125__objc_mutex_lock(objc_mutex_t mutex)
126{
127 return __gthread_objc_mutex_lock (mutex);
128}
129
130/* Try to grab a lock on a mutex. */
131int
132__objc_mutex_trylock(objc_mutex_t mutex)
133{
134 return __gthread_objc_mutex_trylock (mutex);
135}
136
137/* Unlock the mutex */
138int
139__objc_mutex_unlock(objc_mutex_t mutex)
140{
141 return __gthread_objc_mutex_unlock (mutex);
142}
143
144/* Backend condition mutex functions */
145
146/* Allocate a condition. */
147int
148__objc_condition_allocate(objc_condition_t condition)
149{
150 return __gthread_objc_condition_allocate (condition);
151}
152
153/* Deallocate a condition. */
154int
155__objc_condition_deallocate(objc_condition_t condition)
156{
157 return __gthread_objc_condition_deallocate (condition);
158}
159
160/* Wait on the condition */
161int
162__objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
163{
164 return __gthread_objc_condition_wait (condition, mutex);
165}
166
167/* Wake up all threads waiting on this condition. */
168int
169__objc_condition_broadcast(objc_condition_t condition)
170{
171 return __gthread_objc_condition_broadcast (condition);
172}
173
174/* Wake up one thread waiting on this condition. */
175int
176__objc_condition_signal(objc_condition_t condition)
177{
178 return __gthread_objc_condition_signal (condition);
179}
180
181/* End of File */
Note: See TracBrowser for help on using the repository browser.