0
|
1 /* POSIX threads dummy routines for systems without weak definitions. */
|
|
2 /* Compile this one with gcc. */
|
|
3 /* Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009 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 3, 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 Under Section 7 of GPL version 3, you are granted additional
|
|
18 permissions described in the GCC Runtime Library Exception, version
|
|
19 3.1, as published by the Free Software Foundation.
|
|
20
|
|
21 You should have received a copy of the GNU General Public License and
|
|
22 a copy of the GCC Runtime Library Exception along with this program;
|
|
23 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
24 <http://www.gnu.org/licenses/>. */
|
|
25
|
|
26 #include "tconfig.h"
|
|
27 #include "tm.h"
|
|
28 # define __gthrw_pragma(pragma) _Pragma (#pragma)
|
|
29 /* Define so we provide weak definitions of functions used by libobjc only. */
|
|
30 #define _LIBOBJC_WEAK
|
|
31 #include "gthr.h"
|
|
32
|
|
33 int
|
|
34 pthread_once (pthread_once_t *once ATTRIBUTE_UNUSED,
|
|
35 void (*func) (void) ATTRIBUTE_UNUSED)
|
|
36 {
|
|
37 return -1;
|
|
38 }
|
|
39
|
|
40 int
|
|
41 pthread_key_create (pthread_key_t *key ATTRIBUTE_UNUSED,
|
|
42 void (*dtor) (void *) ATTRIBUTE_UNUSED)
|
|
43 {
|
|
44 return -1;
|
|
45 }
|
|
46
|
|
47 int
|
|
48 pthread_key_delete (pthread_key_t key ATTRIBUTE_UNUSED)
|
|
49 {
|
|
50 return 0;
|
|
51 }
|
|
52
|
|
53 void *
|
|
54 pthread_getspecific (pthread_key_t key ATTRIBUTE_UNUSED)
|
|
55 {
|
|
56 return 0;
|
|
57 }
|
|
58
|
|
59 int
|
|
60 pthread_setspecific (pthread_key_t key ATTRIBUTE_UNUSED,
|
|
61 const void *ptr ATTRIBUTE_UNUSED)
|
|
62 {
|
|
63 return 0;
|
|
64 }
|
|
65
|
|
66 int
|
|
67 pthread_create (pthread_t *thread ATTRIBUTE_UNUSED,
|
|
68 const pthread_attr_t *attr ATTRIBUTE_UNUSED,
|
|
69 void *(*start_routine) (void *) ATTRIBUTE_UNUSED,
|
|
70 void *arg ATTRIBUTE_UNUSED)
|
|
71 {
|
|
72 return 0;
|
|
73 }
|
|
74
|
|
75 int
|
|
76 pthread_join (pthread_t thread ATTRIBUTE_UNUSED,
|
|
77 void **value_ptr ATTRIBUTE_UNUSED)
|
|
78 {
|
|
79 return 0;
|
|
80 }
|
|
81
|
|
82 void
|
|
83 pthread_exit (void *value_ptr ATTRIBUTE_UNUSED)
|
|
84 {
|
|
85 }
|
|
86
|
|
87 int
|
|
88 pthread_detach (pthread_t thread ATTRIBUTE_UNUSED)
|
|
89 {
|
|
90 return 0;
|
|
91 }
|
|
92
|
|
93 int
|
|
94 pthread_cancel (pthread_t thread ATTRIBUTE_UNUSED)
|
|
95 {
|
|
96 return 0;
|
|
97 }
|
|
98
|
|
99 int
|
|
100 pthread_mutex_lock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
|
|
101 {
|
|
102 return 0;
|
|
103 }
|
|
104
|
|
105 int
|
|
106 pthread_mutex_trylock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
|
|
107 {
|
|
108 return 0;
|
|
109 }
|
|
110
|
|
111 #ifdef _POSIX_TIMEOUTS
|
|
112 #if _POSIX_TIMEOUTS >= 0
|
|
113 int
|
|
114 pthread_mutex_timedlock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED,
|
|
115 const struct timespec *abs_timeout ATTRIBUTE_UNUSED)
|
|
116 {
|
|
117 return 0;
|
|
118 }
|
|
119 #endif
|
|
120 #endif /* _POSIX_TIMEOUTS */
|
|
121
|
|
122 int
|
|
123 pthread_mutex_unlock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
|
|
124 {
|
|
125 return 0;
|
|
126 }
|
|
127
|
|
128 int
|
|
129 pthread_mutexattr_init (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED)
|
|
130 {
|
|
131 return 0;
|
|
132 }
|
|
133
|
|
134 int
|
|
135 pthread_mutexattr_settype (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED,
|
|
136 int type ATTRIBUTE_UNUSED)
|
|
137 {
|
|
138 return 0;
|
|
139 }
|
|
140
|
|
141 int
|
|
142 pthread_mutexattr_destroy (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED)
|
|
143 {
|
|
144 return 0;
|
|
145 }
|
|
146
|
|
147 int
|
|
148 pthread_cond_broadcast (pthread_cond_t *cond ATTRIBUTE_UNUSED)
|
|
149 {
|
|
150 return 0;
|
|
151 }
|
|
152
|
|
153 int
|
|
154 pthread_cond_destroy (pthread_cond_t *cond ATTRIBUTE_UNUSED)
|
|
155 {
|
|
156 return 0;
|
|
157 }
|
|
158
|
|
159 int
|
|
160 pthread_cond_init (pthread_cond_t *cond ATTRIBUTE_UNUSED,
|
|
161 const pthread_condattr_t *attr ATTRIBUTE_UNUSED)
|
|
162 {
|
|
163 return 0;
|
|
164 }
|
|
165
|
|
166 int
|
|
167 pthread_cond_signal (pthread_cond_t *cond ATTRIBUTE_UNUSED)
|
|
168 {
|
|
169 return 0;
|
|
170 }
|
|
171
|
|
172 int
|
|
173 pthread_cond_wait (pthread_cond_t *cond ATTRIBUTE_UNUSED,
|
|
174 pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
|
|
175 {
|
|
176 return 0;
|
|
177 }
|
|
178
|
|
179 int
|
|
180 pthread_cond_timedwait (pthread_cond_t *cond ATTRIBUTE_UNUSED,
|
|
181 pthread_mutex_t *mutex ATTRIBUTE_UNUSED,
|
|
182 const struct timespec *abstime ATTRIBUTE_UNUSED)
|
|
183 {
|
|
184 return 0;
|
|
185 }
|
|
186
|
|
187 int
|
|
188 pthread_mutex_init (pthread_mutex_t *mutex ATTRIBUTE_UNUSED,
|
|
189 const pthread_mutexattr_t *attr ATTRIBUTE_UNUSED)
|
|
190 {
|
|
191 return 0;
|
|
192 }
|
|
193
|
|
194 int
|
|
195 pthread_mutex_destroy (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
|
|
196 {
|
|
197 return 0;
|
|
198 }
|
|
199
|
|
200 pthread_t
|
|
201 pthread_self (void)
|
|
202 {
|
|
203 return (pthread_t) 0;
|
|
204 }
|
|
205
|
|
206 #ifdef _POSIX_PRIORITY_SCHEDULING
|
|
207 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
|
|
208 int
|
|
209 sched_get_priority_max (int policy ATTRIBUTE_UNUSED)
|
|
210 {
|
|
211 return 0;
|
|
212 }
|
|
213
|
|
214 int
|
|
215 sched_get_priority_min (int policy ATTRIBUTE_UNUSED)
|
|
216 {
|
|
217 return 0;
|
|
218 }
|
|
219 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
|
|
220 #endif /* _POSIX_PRIORITY_SCHEDULING */
|
|
221
|
|
222 int
|
|
223 sched_yield (void)
|
|
224 {
|
|
225 return 0;
|
|
226 }
|
|
227
|
|
228 int
|
|
229 pthread_attr_destroy (pthread_attr_t *attr ATTRIBUTE_UNUSED)
|
|
230 {
|
|
231 return 0;
|
|
232 }
|
|
233
|
|
234 int
|
|
235 pthread_attr_init (pthread_attr_t *attr ATTRIBUTE_UNUSED)
|
|
236 {
|
|
237 return 0;
|
|
238 }
|
|
239
|
|
240 int
|
|
241 pthread_attr_setdetachstate (pthread_attr_t *attr ATTRIBUTE_UNUSED,
|
|
242 int detachstate ATTRIBUTE_UNUSED)
|
|
243 {
|
|
244 return 0;
|
|
245 }
|
|
246
|
|
247 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
|
|
248 int
|
|
249 pthread_getschedparam (pthread_t thread ATTRIBUTE_UNUSED,
|
|
250 int *policy ATTRIBUTE_UNUSED,
|
|
251 struct sched_param *param ATTRIBUTE_UNUSED)
|
|
252 {
|
|
253 return 0;
|
|
254 }
|
|
255
|
|
256 int
|
|
257 pthread_setschedparam (pthread_t thread ATTRIBUTE_UNUSED,
|
|
258 int policy ATTRIBUTE_UNUSED,
|
|
259 const struct sched_param *param ATTRIBUTE_UNUSED)
|
|
260 {
|
|
261 return 0;
|
|
262 }
|
|
263 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
|
|
264
|