1 /* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/include/ac/pthread.h,v 1.18 2017/01/12 14:43:12 masarati Exp $ */
2 /*
3  * This library comes with MBDyn (C), a multibody analysis code.
4  * http://www.mbdyn.org
5  *
6  * Copyright (C) 1996-2017
7  *
8  * Pierangelo Masarati  <masarati@aero.polimi.it>
9  *
10  * Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
11  * via La Masa, 34 - 20156 Milano, Italy
12  * http://www.aero.polimi.it
13  *
14  * Changing this copyright notice is forbidden.
15  *
16  * This program is free software; you can redistribute it and/or modify
17  * it under the terms of the GNU General Public License as published by
18  * the Free Software Foundation (version 2 of the License).
19  *
20  *
21  * This program is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, write to the Free Software
28  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
29  */
30 
31 #ifndef AC_PTHREAD_H
32 #define AC_PTHREAD_H
33 
34 /* libc's <pthread.h> must be included before the pthread_* funcs are called */
35 
36 #ifdef USE_RTAI
37 
38 /* from <pthread.h> */
39 #undef  pthread_create
40 #define pthread_create			pthread_create_rt
41 #undef  pthread_self
42 #define pthread_self			pthread_self_rt
43 #undef  pthread_equal
44 #define pthread_equal			pthread_equal_rt
45 #undef  pthread_exit
46 #define pthread_exit			pthread_exit_rt
47 #undef  pthread_join
48 #define pthread_join			pthread_join_rt
49 #undef  pthread_detach
50 #define pthread_detach			pthread_detach_rt
51 #undef  pthread_attr_init
52 #define pthread_attr_init		pthread_attr_init_rt
53 #undef  pthread_attr_destroy
54 #define pthread_attr_destroy		pthread_attr_destroy_rt
55 #undef  pthread_attr_setdetachstate
56 #define pthread_attr_setdetachstate	pthread_attr_setdetachstate_rt
57 #undef  pthread_attr_getdetachstate
58 #define pthread_attr_getdetachstate	pthread_attr_getdetachstate_rt
59 #undef  pthread_attr_setschedparam
60 #define pthread_attr_setschedparam	pthread_attr_setschedparam_rt
61 #undef  pthread_attr_getschedparam
62 #define pthread_attr_getschedparam	pthread_attr_getschedparam_rt
63 #undef  pthread_attr_setschedpolicy
64 #define pthread_attr_setschedpolicy	pthread_attr_setschedpolicy_rt
65 #undef  pthread_attr_getschedpolicy
66 #define pthread_attr_getschedpolicy	pthread_attr_getschedpolicy_rt
67 #undef  pthread_attr_setinheritsched
68 #define pthread_attr_setinheritsched	pthread_attr_setinheritsched_rt
69 #undef  pthread_attr_getinheritsched
70 #define pthread_attr_getinheritsched	pthread_attr_getinheritsched_rt
71 #undef  pthread_attr_setscope
72 #define pthread_attr_setscope		pthread_attr_setscope_rt
73 #undef  pthread_attr_getscope
74 #define pthread_attr_getscope		pthread_attr_getscope_rt
75 #undef  pthread_attr_setguardsize
76 #define pthread_attr_setguardsize	pthread_attr_setguardsize_rt
77 #undef  pthread_attr_getguardsize
78 #define pthread_attr_getguardsize	pthread_attr_getguardsize_rt
79 #undef  pthread_attr_setstackaddr
80 #define pthread_attr_setstackaddr	pthread_attr_setstackaddr_rt
81 #undef  pthread_attr_getstackaddr
82 #define pthread_attr_getstackaddr	pthread_attr_getstackaddr_rt
83 #undef  pthread_attr_setstack
84 #define pthread_attr_setstack		pthread_attr_setstack_rt
85 #undef  pthread_attr_getstack
86 #define pthread_attr_getstack		pthread_attr_getstack_rt
87 #undef  pthread_attr_setstacksize
88 #define pthread_attr_setstacksize	pthread_attr_setstacksize_rt
89 #undef  pthread_attr_getstacksize
90 #define pthread_attr_getstacksize	pthread_attr_getstacksize_rt
91 #undef  pthread_setschedparam
92 #define pthread_setschedparam		pthread_setschedparam_rt
93 #undef  pthread_getschedparam
94 #define pthread_getschedparam		pthread_getschedparam_rt
95 #undef  pthread_setconcurrency
96 #define pthread_setconcurrency		pthread_setconcurrency_rt
97 #undef  pthread_getconcurrency
98 #define pthread_getconcurrency		pthread_getconcurrency_rt
99 #undef  pthread_mutex_init
100 #define pthread_mutex_init		pthread_mutex_init_rt
101 #undef  pthread_mutex_destroy
102 #define pthread_mutex_destroy		pthread_mutex_destroy_rt
103 #undef  pthread_mutex_trylock
104 #define pthread_mutex_trylock		pthread_mutex_trylock_rt
105 #undef  pthread_mutex_lock
106 #define pthread_mutex_lock		pthread_mutex_lock_rt
107 #undef  pthread_mutex_timedlock
108 #define pthread_mutex_timedlock		pthread_mutex_timedlock_rt
109 #undef  pthread_mutex_unlock
110 #define pthread_mutex_unlock		pthread_mutex_unlock_rt
111 #undef  pthread_mutexattr_init
112 #define pthread_mutexattr_init		pthread_mutexattr_init_rt
113 #undef  pthread_mutexattr_destroy
114 #define pthread_mutexattr_destroy	pthread_mutexattr_destroy_rt
115 #undef  pthread_mutexattr_setpshared
116 #define pthread_mutexattr_setpshared	pthread_mutexattr_setpshared_rt
117 #undef  pthread_mutexattr_getpshared
118 #define pthread_mutexattr_getpshared	pthread_mutexattr_getpshared_rt
119 #undef  pthread_mutexattr_settype
120 #define pthread_mutexattr_settype	pthread_mutexattr_settype_rt
121 #undef  pthread_mutexattr_gettype
122 #define pthread_mutexattr_gettype	pthread_mutexattr_gettype_rt
123 #undef  pthread_cond_init
124 #define pthread_cond_init		pthread_cond_init_rt
125 #undef  pthread_cond_destroy
126 #define pthread_cond_destroy		pthread_cond_destroy_rt
127 #undef  pthread_cond_signal
128 #define pthread_cond_signal		pthread_cond_signal_rt
129 #undef  pthread_cond_broadcast
130 #define pthread_cond_broadcast		pthread_cond_broadcast_rt
131 #undef  pthread_cond_wait
132 #define pthread_cond_wait		pthread_cond_wait_rt
133 #undef  pthread_cond_timedwait
134 #define pthread_cond_timedwait		pthread_cond_timedwait_rt
135 #undef  pthread_condattr_init
136 #define pthread_condattr_init		pthread_condattr_init_rt
137 #undef  pthread_condattr_destroy
138 #define pthread_condattr_destroy	pthread_condattr_destroy_rt
139 #undef  pthread_condattr_getpshared
140 #define pthread_condattr_getpshared	pthread_condattr_getpshared_rt
141 #undef  pthread_condattr_setpshared
142 #define pthread_condattr_setpshared	pthread_condattr_setpshared_rt
143 #undef  pthread_rwlock_init
144 #define pthread_rwlock_init		pthread_rwlock_init_rt
145 #undef  pthread_rwlock_destroy
146 #define pthread_rwlock_destroy		pthread_rwlock_destroy_rt
147 #undef  pthread_rwlock_rdlock
148 #define pthread_rwlock_rdlock		pthread_rwlock_rdlock_rt
149 #undef  pthread_rwlock_tryrdlock
150 #define pthread_rwlock_tryrdlock	pthread_rwlock_tryrdlock_rt
151 #undef  pthread_rwlock_timedrdlock
152 #define pthread_rwlock_timedrdlock	pthread_rwlock_timedrdlock_rt
153 #undef  pthread_rwlock_wrlock
154 #define pthread_rwlock_wrlock		pthread_rwlock_wrlock_rt
155 #undef  pthread_rwlock_trywrlock
156 #define pthread_rwlock_trywrlock	pthread_rwlock_trywrlock_rt
157 #undef  pthread_rwlock_timedwrlock
158 #define pthread_rwlock_timedwrlock	pthread_rwlock_timedwrlock_rt
159 #undef  pthread_rwlock_unlock
160 #define pthread_rwlock_unlock		pthread_rwlock_unlock_rt
161 #undef  pthread_rwlockattr_init
162 #define pthread_rwlockattr_init		pthread_rwlockattr_init_rt
163 #undef  pthread_rwlockattr_destroy
164 #define pthread_rwlockattr_destroy	pthread_rwlockattr_destroy_rt
165 #undef  pthread_rwlockattr_setpshared
166 #define pthread_rwlockattr_setpshared	pthread_rwlockattr_setpshared_rt
167 #undef  pthread_rwlockattr_getpshared
168 #define pthread_rwlockattr_getpshared	pthread_rwlockattr_getpshared_rt
169 #undef  pthread_spin_init
170 #define pthread_spin_init		pthread_spin_init_rt
171 #undef  pthread_spin_destroy
172 #define pthread_spin_destroy		pthread_spin_destroy_rt
173 #undef  pthread_spin_lock
174 #define pthread_spin_lock		pthread_spin_lock_rt
175 #undef  pthread_spin_trylock
176 #define pthread_spin_trylock		pthread_spin_trylock_rt
177 #undef  pthread_spin_unlock
178 #define pthread_spin_unlock		pthread_spin_unlock_rt
179 /* barriers ?... */
180 #undef  pthread_key_create
181 #define pthread_key_create		pthread_key_create_rt
182 #undef  pthread_key_delete
183 #define pthread_key_delete		pthread_key_delete_rt
184 #undef  pthread_setspecific
185 #define pthread_setspecific		pthread_setspecific_rt
186 #undef  pthread_getspecific
187 #define pthread_getspecific		pthread_getspecific_rt
188 #undef  pthread_once
189 #define pthread_once			pthread_once_rt
190 #undef  pthread_setcancelstate
191 #define pthread_setcancelstate		pthread_setcancelstate_rt
192 #undef  pthread_setcanceltype
193 #define pthread_setcanceltype		pthread_setcanceltype_rt
194 #undef  pthread_cancel
195 #define pthread_cancel			pthread_cancel_rt
196 #undef  pthread_testcancel
197 #define pthread_testcancel		pthread_testcancel_rt
198 #undef  pthread_getcpuclockid
199 #define pthread_getcpuclockid		pthread_getcpuclockid_rt
200 #undef  pthread_cleanup_push
201 #define pthread_cleanup_push		pthread_cleanup_push_rt
202 #undef  pthread_cleanup_pop
203 #define pthread_cleanup_pop		pthread_cleanup_pop_rt
204 #undef  pthread_atfork
205 #define pthread_atfork			pthread_atfork_rt
206 /* from <bits/sigthread.h> */
207 #undef  pthread_sigmask
208 #define pthread_sigmask			pthread_sigmask_rt
209 #undef  pthread_kill
210 #define pthread_kill			pthread_kill_rt
211 /* from <semaphore.h> */
212 #undef  sem_init
213 #define sem_init			sem_init_rt
214 #undef  sem_destroy
215 #define sem_destroy			sem_destroy_rt
216 #undef  sem_open
217 #define sem_open			sem_open_rt
218 #undef  sem_close
219 #define sem_close			sem_close_rt
220 #undef  sem_unlink
221 #define sem_unlink			sem_unlink_rt
222 #undef  sem_wait
223 #define sem_wait			sem_wait_rt
224 #undef	sem_timedwait
225 #define	sem_timedwait			sem_timedwait_rt
226 #undef	sem_trywait
227 #define	sem_trywait			sem_trywait_rt
228 #undef	sem_post
229 #define	sem_post			sem_post_rt
230 #undef	sem_getvalue
231 #define	sem_getvalue			sem_getvalue_rt
232 
233 #else /* !USE_RTAI */
234 
235 #ifdef HAVE_PTHREAD_H
236 #include <pthread.h>
237 #endif /* HAVE_PTHREAD_H */
238 #ifdef HAVE_SEMAPHORE_H
239 #include <semaphore.h>
240 #endif /* HAVE_SEMAPHORE_H */
241 
242 #endif /* !USE_RTAI */
243 
244 #endif /* AC_PTHREAD_H */
245 
246