2010-05-09 Paolo Bonzini <bonzini@gnu.org>
[official-gcc.git] / libobjc / thr-rtems.c
blobcb2e68d96481c76fe868c84e61215082c2d47324
1 /* GNU Objective C Runtime Thread Implementation
2 Copyright (C) 1996, 1997, 2009 Free Software Foundation, Inc.
3 Contributed by Galen C. Hunt (gchunt@cs.rochester.edu)
4 Renamed from thr-vxworks.c to thr-rtems.c by
5 Ralf Corsepius (corsepiu@faw.uni-ulm.de)
7 This file is part of GCC.
9 GCC is free software; you can redistribute it and/or modify it under the
10 terms of the GNU General Public License as published by the Free Software
11 Foundation; either version 3, or (at your option) any later version.
13 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 details.
18 Under Section 7 of GPL version 3, you are granted additional
19 permissions described in the GCC Runtime Library Exception, version
20 3.1, as published by the Free Software Foundation.
22 You should have received a copy of the GNU General Public License and
23 a copy of the GCC Runtime Library Exception along with this program;
24 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
25 <http://www.gnu.org/licenses/>. */
28 #include "objc/thr.h"
29 #include "objc/runtime.h"
31 /* Thread local storage for a single thread */
32 static void *thread_local_storage = NULL;
34 /* Backend initialization functions */
36 /* Initialize the threads subsystem. */
37 int
38 __objc_init_thread_system(void)
40 /* No thread support available */
41 return -1;
44 /* Close the threads subsystem. */
45 int
46 __objc_close_thread_system(void)
48 /* No thread support available */
49 return -1;
52 /* Backend thread functions */
54 /* Create a new thread of execution. */
55 objc_thread_t
56 __objc_thread_detach(void (*func)(void *arg), void *arg)
58 /* No thread support available */
59 return NULL;
62 /* Set the current thread's priority. */
63 int
64 __objc_thread_set_priority(int priority)
66 /* No thread support available */
67 return -1;
70 /* Return the current thread's priority. */
71 int
72 __objc_thread_get_priority(void)
74 return OBJC_THREAD_INTERACTIVE_PRIORITY;
77 /* Yield our process time to another thread. */
78 void
79 __objc_thread_yield(void)
81 return;
84 /* Terminate the current thread. */
85 int
86 __objc_thread_exit(void)
88 /* No thread support available */
89 /* Should we really exit the program */
90 /* exit(&__objc_thread_exit_status); */
91 return -1;
94 /* Returns an integer value which uniquely describes a thread. */
95 objc_thread_t
96 __objc_thread_id(void)
98 /* No thread support, use 1. */
99 return (objc_thread_t)1;
102 /* Sets the thread's local storage pointer. */
104 __objc_thread_set_data(void *value)
106 thread_local_storage = value;
107 return 0;
110 /* Returns the thread's local storage pointer. */
111 void *
112 __objc_thread_get_data(void)
114 return thread_local_storage;
117 /* Backend mutex functions */
119 /* Allocate a mutex. */
121 __objc_mutex_allocate(objc_mutex_t mutex)
123 return 0;
126 /* Deallocate a mutex. */
128 __objc_mutex_deallocate(objc_mutex_t mutex)
130 return 0;
133 /* Grab a lock on a mutex. */
135 __objc_mutex_lock(objc_mutex_t mutex)
137 /* There can only be one thread, so we always get the lock */
138 return 0;
141 /* Try to grab a lock on a mutex. */
143 __objc_mutex_trylock(objc_mutex_t mutex)
145 /* There can only be one thread, so we always get the lock */
146 return 0;
149 /* Unlock the mutex */
151 __objc_mutex_unlock(objc_mutex_t mutex)
153 return 0;
156 /* Backend condition mutex functions */
158 /* Allocate a condition. */
160 __objc_condition_allocate(objc_condition_t condition)
162 return 0;
165 /* Deallocate a condition. */
167 __objc_condition_deallocate(objc_condition_t condition)
169 return 0;
172 /* Wait on the condition */
174 __objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
176 return 0;
179 /* Wake up all threads waiting on this condition. */
181 __objc_condition_broadcast(objc_condition_t condition)
183 return 0;
186 /* Wake up one thread waiting on this condition. */
188 __objc_condition_signal(objc_condition_t condition)
190 return 0;
193 /* End of File */