2005-12-29 Paul Brook <paul@codesourcery.com>
[official-gcc.git] / libobjc / thr-single.c
blob0407dcf17cfd31ab016285e574c6adb7f606721c
1 /* GNU Objective C Runtime Thread Implementation
2 Copyright (C) 1996, 1997 Free Software Foundation, Inc.
3 Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
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 along with
17 GCC; see the file COPYING. If not, write to the Free Software
18 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 #include "objc/thr.h"
28 #include "objc/runtime.h"
30 /* Thread local storage for a single thread */
31 static void *thread_local_storage = NULL;
33 /* Backend initialization functions */
35 /* Initialize the threads subsystem. */
36 int
37 __objc_init_thread_system(void)
39 /* No thread support available */
40 return -1;
43 /* Close the threads subsystem. */
44 int
45 __objc_close_thread_system(void)
47 /* No thread support available */
48 return -1;
51 /* Backend thread functions */
53 /* Create a new thread of execution. */
54 objc_thread_t
55 __objc_thread_detach(void (*func)(void *arg), void *arg)
57 /* No thread support available */
58 return NULL;
61 /* Set the current thread's priority. */
62 int
63 __objc_thread_set_priority(int priority)
65 /* No thread support available */
66 return -1;
69 /* Return the current thread's priority. */
70 int
71 __objc_thread_get_priority(void)
73 return OBJC_THREAD_INTERACTIVE_PRIORITY;
76 /* Yield our process time to another thread. */
77 void
78 __objc_thread_yield(void)
80 return;
83 /* Terminate the current thread. */
84 int
85 __objc_thread_exit(void)
87 /* No thread support available */
88 /* Should we really exit the program */
89 /* exit(&__objc_thread_exit_status); */
90 return -1;
93 /* Returns an integer value which uniquely describes a thread. */
94 objc_thread_t
95 __objc_thread_id(void)
97 /* No thread support, use 1. */
98 return (objc_thread_t)1;
101 /* Sets the thread's local storage pointer. */
103 __objc_thread_set_data(void *value)
105 thread_local_storage = value;
106 return 0;
109 /* Returns the thread's local storage pointer. */
110 void *
111 __objc_thread_get_data(void)
113 return thread_local_storage;
116 /* Backend mutex functions */
118 /* Allocate a mutex. */
120 __objc_mutex_allocate(objc_mutex_t mutex)
122 return 0;
125 /* Deallocate a mutex. */
127 __objc_mutex_deallocate(objc_mutex_t mutex)
129 return 0;
132 /* Grab a lock on a mutex. */
134 __objc_mutex_lock(objc_mutex_t mutex)
136 /* There can only be one thread, so we always get the lock */
137 return 0;
140 /* Try to grab a lock on a mutex. */
142 __objc_mutex_trylock(objc_mutex_t mutex)
144 /* There can only be one thread, so we always get the lock */
145 return 0;
148 /* Unlock the mutex */
150 __objc_mutex_unlock(objc_mutex_t mutex)
152 return 0;
155 /* Backend condition mutex functions */
157 /* Allocate a condition. */
159 __objc_condition_allocate(objc_condition_t condition)
161 return 0;
164 /* Deallocate a condition. */
166 __objc_condition_deallocate(objc_condition_t condition)
168 return 0;
171 /* Wait on the condition */
173 __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
175 return 0;
178 /* Wake up all threads waiting on this condition. */
180 __objc_condition_broadcast(objc_condition_t condition)
182 return 0;
185 /* Wake up one thread waiting on this condition. */
187 __objc_condition_signal(objc_condition_t condition)
189 return 0;
192 /* End of File */