OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [gthr-single.h] - Blame information for rev 199

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 38 julius
/* Threads compatibility routines for libgcc2 and libobjc.  */
2
/* Compile this one with gcc.  */
3
/* Copyright (C) 1997, 1999, 2000, 2004 Free Software Foundation, Inc.
4
 
5
This file is part of GCC.
6
 
7
GCC is free software; you can redistribute it and/or modify it under
8
the terms of the GNU General Public License as published by the Free
9
Software Foundation; either version 2, or (at your option) any later
10
version.
11
 
12
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13
WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15
for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with GCC; see the file COPYING.  If not, write to the Free
19
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
20
02110-1301, USA.  */
21
 
22
/* As a special exception, if you link this library with other files,
23
   some of which are compiled with GCC, to produce an executable,
24
   this library does not by itself cause the resulting executable
25
   to be covered by the GNU General Public License.
26
   This exception does not however invalidate any other reasons why
27
   the executable file might be covered by the GNU General Public License.  */
28
 
29
#ifndef GCC_GTHR_SINGLE_H
30
#define GCC_GTHR_SINGLE_H
31
 
32
/* Just provide compatibility for mutex handling.  */
33
 
34
typedef int __gthread_mutex_t;
35
typedef int __gthread_recursive_mutex_t;
36
 
37
#define __GTHREAD_MUTEX_INIT 0
38
 
39
#ifdef __cplusplus
40
#define UNUSED(x)
41
#else
42
#define UNUSED(x) x __attribute__((unused))
43
#endif
44
 
45
#ifdef _LIBOBJC
46
 
47
/* Thread local storage for a single thread */
48
static void *thread_local_storage = NULL;
49
 
50
/* Backend initialization functions */
51
 
52
/* Initialize the threads subsystem.  */
53
static inline int
54
__gthread_objc_init_thread_system (void)
55
{
56
  /* No thread support available */
57
  return -1;
58
}
59
 
60
/* Close the threads subsystem.  */
61
static inline int
62
__gthread_objc_close_thread_system (void)
63
{
64
  /* No thread support available */
65
  return -1;
66
}
67
 
68
/* Backend thread functions */
69
 
70
/* Create a new thread of execution.  */
71
static inline objc_thread_t
72
__gthread_objc_thread_detach (void (* func)(void *), void * UNUSED(arg))
73
{
74
  /* No thread support available */
75
  return NULL;
76
}
77
 
78
/* Set the current thread's priority.  */
79
static inline int
80
__gthread_objc_thread_set_priority (int UNUSED(priority))
81
{
82
  /* No thread support available */
83
  return -1;
84
}
85
 
86
/* Return the current thread's priority.  */
87
static inline int
88
__gthread_objc_thread_get_priority (void)
89
{
90
  return OBJC_THREAD_INTERACTIVE_PRIORITY;
91
}
92
 
93
/* Yield our process time to another thread.  */
94
static inline void
95
__gthread_objc_thread_yield (void)
96
{
97
  return;
98
}
99
 
100
/* Terminate the current thread.  */
101
static inline int
102
__gthread_objc_thread_exit (void)
103
{
104
  /* No thread support available */
105
  /* Should we really exit the program */
106
  /* exit (&__objc_thread_exit_status); */
107
  return -1;
108
}
109
 
110
/* Returns an integer value which uniquely describes a thread.  */
111
static inline objc_thread_t
112
__gthread_objc_thread_id (void)
113
{
114
  /* No thread support, use 1.  */
115
  return (objc_thread_t) 1;
116
}
117
 
118
/* Sets the thread's local storage pointer.  */
119
static inline int
120
__gthread_objc_thread_set_data (void *value)
121
{
122
  thread_local_storage = value;
123
  return 0;
124
}
125
 
126
/* Returns the thread's local storage pointer.  */
127
static inline void *
128
__gthread_objc_thread_get_data (void)
129
{
130
  return thread_local_storage;
131
}
132
 
133
/* Backend mutex functions */
134
 
135
/* Allocate a mutex.  */
136
static inline int
137
__gthread_objc_mutex_allocate (objc_mutex_t UNUSED(mutex))
138
{
139
  return 0;
140
}
141
 
142
/* Deallocate a mutex.  */
143
static inline int
144
__gthread_objc_mutex_deallocate (objc_mutex_t UNUSED(mutex))
145
{
146
  return 0;
147
}
148
 
149
/* Grab a lock on a mutex.  */
150
static inline int
151
__gthread_objc_mutex_lock (objc_mutex_t UNUSED(mutex))
152
{
153
  /* There can only be one thread, so we always get the lock */
154
  return 0;
155
}
156
 
157
/* Try to grab a lock on a mutex.  */
158
static inline int
159
__gthread_objc_mutex_trylock (objc_mutex_t UNUSED(mutex))
160
{
161
  /* There can only be one thread, so we always get the lock */
162
  return 0;
163
}
164
 
165
/* Unlock the mutex */
166
static inline int
167
__gthread_objc_mutex_unlock (objc_mutex_t UNUSED(mutex))
168
{
169
  return 0;
170
}
171
 
172
/* Backend condition mutex functions */
173
 
174
/* Allocate a condition.  */
175
static inline int
176
__gthread_objc_condition_allocate (objc_condition_t UNUSED(condition))
177
{
178
  return 0;
179
}
180
 
181
/* Deallocate a condition.  */
182
static inline int
183
__gthread_objc_condition_deallocate (objc_condition_t UNUSED(condition))
184
{
185
  return 0;
186
}
187
 
188
/* Wait on the condition */
189
static inline int
190
__gthread_objc_condition_wait (objc_condition_t UNUSED(condition),
191
                               objc_mutex_t UNUSED(mutex))
192
{
193
  return 0;
194
}
195
 
196
/* Wake up all threads waiting on this condition.  */
197
static inline int
198
__gthread_objc_condition_broadcast (objc_condition_t UNUSED(condition))
199
{
200
  return 0;
201
}
202
 
203
/* Wake up one thread waiting on this condition.  */
204
static inline int
205
__gthread_objc_condition_signal (objc_condition_t UNUSED(condition))
206
{
207
  return 0;
208
}
209
 
210
#else /* _LIBOBJC */
211
 
212
static inline int
213
__gthread_active_p (void)
214
{
215
  return 0;
216
}
217
 
218
static inline int
219
__gthread_mutex_lock (__gthread_mutex_t * UNUSED(mutex))
220
{
221
  return 0;
222
}
223
 
224
static inline int
225
__gthread_mutex_trylock (__gthread_mutex_t * UNUSED(mutex))
226
{
227
  return 0;
228
}
229
 
230
static inline int
231
__gthread_mutex_unlock (__gthread_mutex_t * UNUSED(mutex))
232
{
233
  return 0;
234
}
235
 
236
static inline int
237
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
238
{
239
  return __gthread_mutex_lock (mutex);
240
}
241
 
242
static inline int
243
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
244
{
245
  return __gthread_mutex_trylock (mutex);
246
}
247
 
248
static inline int
249
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
250
{
251
  return __gthread_mutex_unlock (mutex);
252
}
253
 
254
#endif /* _LIBOBJC */
255
 
256
#undef UNUSED
257
 
258
#endif /* ! GCC_GTHR_SINGLE_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.