1 /* POSIX threads dummy routines for systems without weak definitions.  */
2 /* Compile this one with gcc.  */
3 /* Copyright (C) 2003, 2004, 2005 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 #include "tconfig.h"
30 #include "tm.h"
31 /* Define so we provide weak definitions of functions used by libobjc only.  */
32 #define _LIBOBJC_WEAK
33 #include "gthr.h"
34 
35 int
pthread_once(pthread_once_t * once ATTRIBUTE_UNUSED,void (* func)(void)ATTRIBUTE_UNUSED)36 pthread_once (pthread_once_t *once ATTRIBUTE_UNUSED,
37 	      void (*func) (void) ATTRIBUTE_UNUSED)
38 {
39   return -1;
40 }
41 
42 int
pthread_key_create(pthread_key_t * key ATTRIBUTE_UNUSED,void (* dtor)(void *)ATTRIBUTE_UNUSED)43 pthread_key_create (pthread_key_t *key ATTRIBUTE_UNUSED,
44 		    void (*dtor) (void *) ATTRIBUTE_UNUSED)
45 {
46   return -1;
47 }
48 
49 int
pthread_key_delete(pthread_key_t key ATTRIBUTE_UNUSED)50 pthread_key_delete (pthread_key_t key ATTRIBUTE_UNUSED)
51 {
52   return 0;
53 }
54 
55 void *
pthread_getspecific(pthread_key_t key ATTRIBUTE_UNUSED)56 pthread_getspecific (pthread_key_t key ATTRIBUTE_UNUSED)
57 {
58   return 0;
59 }
60 
61 int
pthread_setspecific(pthread_key_t key ATTRIBUTE_UNUSED,const void * ptr ATTRIBUTE_UNUSED)62 pthread_setspecific (pthread_key_t key ATTRIBUTE_UNUSED,
63 		     const void *ptr ATTRIBUTE_UNUSED)
64 {
65   return 0;
66 }
67 
68 int
pthread_create(pthread_t * thread ATTRIBUTE_UNUSED,const pthread_attr_t * attr ATTRIBUTE_UNUSED,void * (* start_routine)(void *)ATTRIBUTE_UNUSED,void * arg ATTRIBUTE_UNUSED)69 pthread_create (pthread_t *thread ATTRIBUTE_UNUSED,
70 		const pthread_attr_t *attr ATTRIBUTE_UNUSED,
71 		void *(*start_routine) (void *) ATTRIBUTE_UNUSED,
72 		void *arg ATTRIBUTE_UNUSED)
73 {
74   return 0;
75 }
76 
77 int
pthread_cancel(pthread_t thread ATTRIBUTE_UNUSED)78 pthread_cancel(pthread_t thread ATTRIBUTE_UNUSED)
79 {
80   return 0;
81 }
82 
83 int
pthread_mutex_lock(pthread_mutex_t * mutex ATTRIBUTE_UNUSED)84 pthread_mutex_lock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
85 {
86   return 0;
87 }
88 
89 int
pthread_mutex_trylock(pthread_mutex_t * mutex ATTRIBUTE_UNUSED)90 pthread_mutex_trylock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
91 {
92   return 0;
93 }
94 
95 int
pthread_mutex_unlock(pthread_mutex_t * mutex ATTRIBUTE_UNUSED)96 pthread_mutex_unlock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
97 {
98   return 0;
99 }
100 
101 int
pthread_mutexattr_init(pthread_mutexattr_t * attr ATTRIBUTE_UNUSED)102 pthread_mutexattr_init (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED)
103 {
104   return 0;
105 }
106 
107 int
pthread_mutexattr_settype(pthread_mutexattr_t * attr ATTRIBUTE_UNUSED,int type ATTRIBUTE_UNUSED)108 pthread_mutexattr_settype (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED,
109 			   int type ATTRIBUTE_UNUSED)
110 {
111   return 0;
112 }
113 
114 int
pthread_mutexattr_destroy(pthread_mutexattr_t * attr ATTRIBUTE_UNUSED)115 pthread_mutexattr_destroy (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED)
116 {
117   return 0;
118 }
119 
120 int
pthread_cond_broadcast(pthread_cond_t * cond ATTRIBUTE_UNUSED)121 pthread_cond_broadcast (pthread_cond_t *cond ATTRIBUTE_UNUSED)
122 {
123   return 0;
124 }
125 
126 int
pthread_cond_destroy(pthread_cond_t * cond ATTRIBUTE_UNUSED)127 pthread_cond_destroy (pthread_cond_t *cond ATTRIBUTE_UNUSED)
128 {
129   return 0;
130 }
131 
132 int
pthread_cond_init(pthread_cond_t * cond ATTRIBUTE_UNUSED,const pthread_condattr_t * attr ATTRIBUTE_UNUSED)133 pthread_cond_init (pthread_cond_t *cond ATTRIBUTE_UNUSED,
134 		   const pthread_condattr_t *attr ATTRIBUTE_UNUSED)
135 {
136   return 0;
137 }
138 
139 int
pthread_cond_signal(pthread_cond_t * cond ATTRIBUTE_UNUSED)140 pthread_cond_signal (pthread_cond_t *cond ATTRIBUTE_UNUSED)
141 {
142   return 0;
143 }
144 
145 int
pthread_cond_wait(pthread_cond_t * cond ATTRIBUTE_UNUSED,pthread_mutex_t * mutex ATTRIBUTE_UNUSED)146 pthread_cond_wait (pthread_cond_t *cond ATTRIBUTE_UNUSED,
147 		   pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
148 {
149   return 0;
150 }
151 
152 void
pthread_exit(void * value_ptr ATTRIBUTE_UNUSED)153 pthread_exit (void *value_ptr ATTRIBUTE_UNUSED)
154 {
155 }
156 
157 int
pthread_mutex_init(pthread_mutex_t * mutex ATTRIBUTE_UNUSED,const pthread_mutexattr_t * attr ATTRIBUTE_UNUSED)158 pthread_mutex_init (pthread_mutex_t *mutex ATTRIBUTE_UNUSED,
159 		    const pthread_mutexattr_t *attr ATTRIBUTE_UNUSED)
160 {
161   return 0;
162 }
163 
164 int
pthread_mutex_destroy(pthread_mutex_t * mutex ATTRIBUTE_UNUSED)165 pthread_mutex_destroy (pthread_mutex_t *mutex ATTRIBUTE_UNUSED)
166 {
167   return 0;
168 }
169 
170 pthread_t
pthread_self(void)171 pthread_self (void)
172 {
173   return (pthread_t) 0;
174 }
175 #ifdef _POSIX_PRIORITY_SCHEDULING
176 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
177 int
sched_get_priority_max(int policy ATTRIBUTE_UNUSED)178 sched_get_priority_max (int policy ATTRIBUTE_UNUSED)
179 {
180   return 0;
181 }
182 
183 int
sched_get_priority_min(int policy ATTRIBUTE_UNUSED)184 sched_get_priority_min (int policy ATTRIBUTE_UNUSED)
185 {
186   return 0;
187 }
188 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
189 #endif /* _POSIX_PRIORITY_SCHEDULING */
190 
191 int
sched_yield(void)192 sched_yield (void)
193 {
194   return 0;
195 }
196 
197 int
pthread_attr_destroy(pthread_attr_t * attr ATTRIBUTE_UNUSED)198 pthread_attr_destroy (pthread_attr_t *attr ATTRIBUTE_UNUSED)
199 {
200   return 0;
201 }
202 
203 int
pthread_attr_init(pthread_attr_t * attr ATTRIBUTE_UNUSED)204 pthread_attr_init (pthread_attr_t *attr ATTRIBUTE_UNUSED)
205 {
206   return 0;
207 }
208 
209 int
pthread_attr_setdetachstate(pthread_attr_t * attr ATTRIBUTE_UNUSED,int detachstate ATTRIBUTE_UNUSED)210 pthread_attr_setdetachstate (pthread_attr_t *attr ATTRIBUTE_UNUSED,
211 			     int detachstate ATTRIBUTE_UNUSED)
212 {
213   return 0;
214 }
215 
216 #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING
217 int
pthread_getschedparam(pthread_t thread ATTRIBUTE_UNUSED,int * policy ATTRIBUTE_UNUSED,struct sched_param * param ATTRIBUTE_UNUSED)218 pthread_getschedparam (pthread_t thread ATTRIBUTE_UNUSED,
219 		       int *policy ATTRIBUTE_UNUSED,
220 		       struct sched_param *param ATTRIBUTE_UNUSED)
221 {
222   return 0;
223 }
224 
225 int
pthread_setschedparam(pthread_t thread ATTRIBUTE_UNUSED,int policy ATTRIBUTE_UNUSED,const struct sched_param * param ATTRIBUTE_UNUSED)226 pthread_setschedparam (pthread_t thread ATTRIBUTE_UNUSED,
227 		       int policy ATTRIBUTE_UNUSED,
228 		       const struct sched_param *param ATTRIBUTE_UNUSED)
229 {
230   return 0;
231 }
232 #endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */
233 
234