2 Copyright (c) 2011-2013 mingw-w64 project
4 Permission is hereby granted, free of charge, to any person obtaining a
5 copy of this software and associated documentation files (the "Software"),
6 to deal in the Software without restriction, including without limitation
7 the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and/or sell copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 DEALINGS IN THE SOFTWARE.
24 * Parts of this library are derived by:
26 * Posix Threads library for Microsoft Windows
28 * Use at own risk, there is no implied warranty to this code.
29 * It uses undocumented features of Microsoft Windows that can change
30 * at any time in the future.
32 * (C) 2010 Lockless Inc.
33 * All rights reserved.
35 * Redistribution and use in source and binary forms, with or without modification,
36 * are permitted provided that the following conditions are met:
39 * * Redistributions of source code must retain the above copyright notice,
40 * this list of conditions and the following disclaimer.
41 * * Redistributions in binary form must reproduce the above copyright notice,
42 * this list of conditions and the following disclaimer in the documentation
43 * and/or other materials provided with the distribution.
44 * * Neither the name of Lockless Inc. nor the names of its contributors may be
45 * used to endorse or promote products derived from this software without
46 * specific prior written permission.
48 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AN
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
50 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
51 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
52 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
53 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
54 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
55 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
56 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
57 * OF THE POSSIBILITY OF SUCH DAMAGE.
59 #ifndef WIN_PTHREADS_H
60 #define WIN_PTHREADS_H
64 #include <sys/types.h>
70 #include <sys/timeb.h>
72 #include "pthread_compat.h"
78 #define __WINPTHREADS_VERSION_MAJOR 0
79 #define __WINPTHREADS_VERSION_MINOR 5
80 #define __WINPTHREADS_VERSION_PATCHLEVEL 0
82 /* MSB 8-bit major version, 8-bit minor version, 16-bit patch level. */
83 #define __WINPTHREADS_VERSION 0x00050000
85 #if defined DLL_EXPORT
87 #define WINPTHREAD_API __declspec(dllexport)
89 #define WINPTHREAD_API __declspec(dllimport)
92 #define WINPTHREAD_API
95 /* #define WINPTHREAD_DBG 1 */
97 /* Compatibility stuff: */
98 #define RWLS_PER_THREAD 8
102 #define ETIMEDOUT 138
108 #define EWOULDBLOCK 140
111 /* pthread specific defines. */
113 #define PTHREAD_CANCEL_DISABLE 0
114 #define PTHREAD_CANCEL_ENABLE 0x01
116 #define PTHREAD_CANCEL_DEFERRED 0
117 #define PTHREAD_CANCEL_ASYNCHRONOUS 0x02
119 #define PTHREAD_CREATE_JOINABLE 0
120 #define PTHREAD_CREATE_DETACHED 0x04
122 #define PTHREAD_EXPLICIT_SCHED 0
123 #define PTHREAD_INHERIT_SCHED 0x08
125 #define PTHREAD_SCOPE_PROCESS 0
126 #define PTHREAD_SCOPE_SYSTEM 0x10
128 #define PTHREAD_DEFAULT_ATTR (PTHREAD_CANCEL_ENABLE)
130 #define PTHREAD_CANCELED ((void *) (intptr_t) 0xDEADBEEF)
132 #define _PTHREAD_NULL_THREAD ((pthread_t) 0)
134 #define PTHREAD_ONCE_INIT 0
136 #define PTHREAD_DESTRUCTOR_ITERATIONS 256
137 #define PTHREAD_KEYS_MAX (1<<20)
139 #define PTHREAD_MUTEX_NORMAL 0
140 #define PTHREAD_MUTEX_ERRORCHECK 1
141 #define PTHREAD_MUTEX_RECURSIVE 2
142 #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL
144 #define PTHREAD_MUTEX_SHARED 1
145 #define PTHREAD_MUTEX_PRIVATE 0
147 #define PTHREAD_PRIO_NONE 0
148 #define PTHREAD_PRIO_INHERIT 8
149 #define PTHREAD_PRIO_PROTECT 16
150 #define PTHREAD_PRIO_MULT 32
151 #define PTHREAD_PROCESS_SHARED 1
152 #define PTHREAD_PROCESS_PRIVATE 0
154 #define PTHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_NORMAL
155 #define PTHREAD_MUTEX_TIMED_NP PTHREAD_MUTEX_FAST_NP
156 #define PTHREAD_MUTEX_ADAPTIVE_NP PTHREAD_MUTEX_FAST_NP
157 #define PTHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK
158 #define PTHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
160 void * WINPTHREAD_API pthread_timechange_handler_np(void * dummy);
161 int WINPTHREAD_API pthread_delay_np (const struct timespec *interval);
162 int WINPTHREAD_API pthread_num_processors_np(void);
163 int WINPTHREAD_API pthread_set_num_processors_np(int n);
165 #define PTHREAD_BARRIER_SERIAL_THREAD 1
167 /* maximum number of times a read lock may be obtained */
168 #define MAX_READ_LOCKS (INT_MAX - 1)
170 /* No fork() in windows - so ignore this */
171 #define pthread_atfork(F1,F2,F3) 0
173 /* unsupported stuff: */
174 #define pthread_mutex_getprioceiling(M, P) ENOTSUP
175 #define pthread_mutex_setprioceiling(M, P) ENOTSUP
176 #define pthread_getcpuclockid(T, C) ENOTSUP
177 #define pthread_attr_getguardsize(A, S) ENOTSUP
178 #define pthread_attr_setgaurdsize(A, S) ENOTSUP
179 #define pthread_attr_getschedpolicy(A, S) ENOTSUP
180 #define pthread_attr_setschedpolicy(A, S) ENOTSUP
182 typedef long pthread_once_t;
183 typedef unsigned pthread_mutexattr_t;
184 typedef unsigned pthread_key_t;
185 typedef void *pthread_barrierattr_t;
186 typedef int pthread_condattr_t;
187 typedef int pthread_rwlockattr_t;
192 typedef struct pthread_t {
193 struct _pthread_v *p;
198 typedef uintptr_t pthread_t;
200 typedef struct _pthread_cleanup _pthread_cleanup;
201 struct _pthread_cleanup
203 void (*func)(void *);
205 _pthread_cleanup *next;
208 #define pthread_cleanup_push(F, A)\
210 const _pthread_cleanup _pthread_cup = {(F), (A), *pthread_getclean()};\
211 __sync_synchronize();\
212 *pthread_getclean() = (_pthread_cleanup *) &_pthread_cup;\
215 /* Note that if async cancelling is used, then there is a race here */
216 #define pthread_cleanup_pop(E)\
217 (*pthread_getclean() = _pthread_cup.next, (E?_pthread_cup.func((pthread_once_t *)_pthread_cup.arg):0));}
219 /* Windows doesn't have this, so declare it ourselves. */
220 #ifndef _TIMESPEC_DEFINED
221 #define _TIMESPEC_DEFINED
223 time_t tv_sec; /* Seconds */
224 long tv_nsec; /* Nanoseconds */
228 struct timespec it_interval; /* Timer period */
229 struct timespec it_value; /* Timer expiration */
234 /* Some POSIX realtime extensions, mostly stubbed */
235 #define SCHED_OTHER 0
238 #define SCHED_MIN SCHED_OTHER
239 #define SCHED_MAX SCHED_RR
245 int WINPTHREAD_API sched_yield(void);
246 int WINPTHREAD_API sched_get_priority_min(int pol);
247 int WINPTHREAD_API sched_get_priority_max(int pol);
248 int WINPTHREAD_API sched_getscheduler(pid_t pid);
249 int WINPTHREAD_API sched_setscheduler(pid_t pid, int pol, const struct sched_param *param);
253 typedef struct pthread_attr_t pthread_attr_t;
254 struct pthread_attr_t
259 struct sched_param param;
262 int WINPTHREAD_API pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param);
263 int WINPTHREAD_API pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param);
264 int WINPTHREAD_API pthread_getschedparam(pthread_t thread, int *pol, struct sched_param *param);
265 int WINPTHREAD_API pthread_setschedparam(pthread_t thread, int pol, const struct sched_param *param);
267 /* synchronization objects */
268 typedef void *pthread_spinlock_t;
269 typedef void *pthread_mutex_t;
270 typedef void *pthread_cond_t;
271 typedef void *pthread_rwlock_t;
272 typedef void *pthread_barrier_t;
274 #define PTHREAD_MUTEX_NORMAL 0
275 #define PTHREAD_MUTEX_ERRORCHECK 1
276 #define PTHREAD_MUTEX_RECURSIVE 2
278 #define GENERIC_INITIALIZER ((void *) (size_t) -1)
279 #define GENERIC_ERRORCHECK_INITIALIZER ((void *) (size_t) -2)
280 #define GENERIC_RECURSIVE_INITIALIZER ((void *) (size_t) -3)
281 #define GENERIC_NORMAL_INITIALIZER ((void *) (size_t) -1)
282 #define PTHREAD_MUTEX_INITIALIZER (pthread_mutex_t *)GENERIC_INITIALIZER
283 #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER (pthread_mutex_t *)GENERIC_RECURSIVE_INITIALIZER
284 #define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER (pthread_mutex_t *)GENERIC_ERRORCHECK_INITIALIZER
285 #define PTHREAD_NORMAL_MUTEX_INITIALIZER (pthread_mutex_t *)GENERIC_NORMAL_INITIALIZER
286 #define PTHREAD_DEFAULT_MUTEX_INITIALIZER PTHREAD_NORMAL_MUTEX_INITIALIZER
287 #define PTHREAD_COND_INITIALIZER (pthread_cond_t *)GENERIC_INITIALIZER
288 #define PTHREAD_RWLOCK_INITIALIZER (pthread_rwlock_t *)GENERIC_INITIALIZER
289 #define PTHREAD_SPINLOCK_INITIALIZER (pthread_spinlock_t *)GENERIC_INITIALIZER
291 extern void WINPTHREAD_API (**_pthread_key_dest)(void *);
292 int WINPTHREAD_API pthread_key_create(pthread_key_t *key, void (* dest)(void *));
293 int WINPTHREAD_API pthread_key_delete(pthread_key_t key);
294 void * WINPTHREAD_API pthread_getspecific(pthread_key_t key);
295 int WINPTHREAD_API pthread_setspecific(pthread_key_t key, const void *value);
297 pthread_t WINPTHREAD_API pthread_self(void);
298 int WINPTHREAD_API pthread_once(pthread_once_t *o, void (*func)(void));
299 void WINPTHREAD_API pthread_testcancel(void);
300 int WINPTHREAD_API pthread_equal(pthread_t t1, pthread_t t2);
301 void WINPTHREAD_API pthread_tls_init(void);
302 void WINPTHREAD_API _pthread_cleanup_dest(pthread_t t);
303 pthread_t WINPTHREAD_API pthread_self(void);
304 int WINPTHREAD_API pthread_get_concurrency(int *val);
305 int WINPTHREAD_API pthread_set_concurrency(int val);
306 void WINPTHREAD_API pthread_exit(void *res);
307 void WINPTHREAD_API _pthread_invoke_cancel(void);
308 void WINPTHREAD_API pthread_testcancel(void);
309 int WINPTHREAD_API pthread_cancel(pthread_t t);
310 int WINPTHREAD_API pthread_kill(pthread_t t, int sig);
311 unsigned WINPTHREAD_API _pthread_get_state(const pthread_attr_t *attr, unsigned flag);
312 int WINPTHREAD_API _pthread_set_state(pthread_attr_t *attr, unsigned flag, unsigned val);
313 int WINPTHREAD_API pthread_setcancelstate(int state, int *oldstate);
314 int WINPTHREAD_API pthread_setcanceltype(int type, int *oldtype);
315 int WINPTHREAD_API pthread_create_wrapper(void *args);
316 int WINPTHREAD_API pthread_create(pthread_t *th, const pthread_attr_t *attr, void *(* func)(void *), void *arg);
317 int WINPTHREAD_API pthread_join(pthread_t t, void **res);
318 int WINPTHREAD_API pthread_detach(pthread_t t);
320 int WINPTHREAD_API pthread_rwlock_init(pthread_rwlock_t *rwlock_, const pthread_rwlockattr_t *attr);
321 int WINPTHREAD_API pthread_rwlock_wrlock(pthread_rwlock_t *l);
322 int WINPTHREAD_API pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *ts);
323 int WINPTHREAD_API pthread_rwlock_rdlock(pthread_rwlock_t *l);
324 int WINPTHREAD_API pthread_rwlock_timedrdlock(pthread_rwlock_t *l, const struct timespec *ts);
325 int WINPTHREAD_API pthread_rwlock_unlock(pthread_rwlock_t *l);
326 int WINPTHREAD_API pthread_rwlock_tryrdlock(pthread_rwlock_t *l);
327 int WINPTHREAD_API pthread_rwlock_trywrlock(pthread_rwlock_t *l);
328 int WINPTHREAD_API pthread_rwlock_destroy (pthread_rwlock_t *l);
330 int WINPTHREAD_API pthread_cond_init(pthread_cond_t *cv, const pthread_condattr_t *a);
331 int WINPTHREAD_API pthread_cond_destroy(pthread_cond_t *cv);
332 int WINPTHREAD_API pthread_cond_signal (pthread_cond_t *cv);
333 int WINPTHREAD_API pthread_cond_broadcast (pthread_cond_t *cv);
334 int WINPTHREAD_API pthread_cond_wait (pthread_cond_t *cv, pthread_mutex_t *external_mutex);
335 int WINPTHREAD_API pthread_cond_timedwait(pthread_cond_t *cv, pthread_mutex_t *external_mutex, const struct timespec *t);
337 int WINPTHREAD_API pthread_mutex_lock(pthread_mutex_t *m);
338 int WINPTHREAD_API pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec *ts);
339 int WINPTHREAD_API pthread_mutex_unlock(pthread_mutex_t *m);
340 int WINPTHREAD_API pthread_mutex_trylock(pthread_mutex_t *m);
341 int WINPTHREAD_API pthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *a);
342 int WINPTHREAD_API pthread_mutex_destroy(pthread_mutex_t *m);
344 int WINPTHREAD_API pthread_barrier_destroy(pthread_barrier_t *b);
345 int WINPTHREAD_API pthread_barrier_init(pthread_barrier_t *b, const void *attr, unsigned int count);
346 int WINPTHREAD_API pthread_barrier_wait(pthread_barrier_t *b);
348 int WINPTHREAD_API pthread_spin_init(pthread_spinlock_t *l, int pshared);
349 int WINPTHREAD_API pthread_spin_destroy(pthread_spinlock_t *l);
350 /* No-fair spinlock due to lack of knowledge of thread number. */
351 int WINPTHREAD_API pthread_spin_lock(pthread_spinlock_t *l);
352 int WINPTHREAD_API pthread_spin_trylock(pthread_spinlock_t *l);
353 int WINPTHREAD_API pthread_spin_unlock(pthread_spinlock_t *l);
355 int WINPTHREAD_API pthread_attr_init(pthread_attr_t *attr);
356 int WINPTHREAD_API pthread_attr_destroy(pthread_attr_t *attr);
357 int WINPTHREAD_API pthread_attr_setdetachstate(pthread_attr_t *a, int flag);
358 int WINPTHREAD_API pthread_attr_getdetachstate(const pthread_attr_t *a, int *flag);
359 int WINPTHREAD_API pthread_attr_setinheritsched(pthread_attr_t *a, int flag);
360 int WINPTHREAD_API pthread_attr_getinheritsched(const pthread_attr_t *a, int *flag);
361 int WINPTHREAD_API pthread_attr_setscope(pthread_attr_t *a, int flag);
362 int WINPTHREAD_API pthread_attr_getscope(const pthread_attr_t *a, int *flag);
363 int WINPTHREAD_API pthread_attr_getstackaddr(pthread_attr_t *attr, void **stack);
364 int WINPTHREAD_API pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack);
365 int WINPTHREAD_API pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *size);
366 int WINPTHREAD_API pthread_attr_setstacksize(pthread_attr_t *attr, size_t size);
368 int WINPTHREAD_API pthread_mutexattr_init(pthread_mutexattr_t *a);
369 int WINPTHREAD_API pthread_mutexattr_destroy(pthread_mutexattr_t *a);
370 int WINPTHREAD_API pthread_mutexattr_gettype(const pthread_mutexattr_t *a, int *type);
371 int WINPTHREAD_API pthread_mutexattr_settype(pthread_mutexattr_t *a, int type);
372 int WINPTHREAD_API pthread_mutexattr_getpshared(const pthread_mutexattr_t *a, int *type);
373 int WINPTHREAD_API pthread_mutexattr_setpshared(pthread_mutexattr_t * a, int type);
374 int WINPTHREAD_API pthread_mutexattr_getprotocol(const pthread_mutexattr_t *a, int *type);
375 int WINPTHREAD_API pthread_mutexattr_setprotocol(pthread_mutexattr_t *a, int type);
376 int WINPTHREAD_API pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *a, int * prio);
377 int WINPTHREAD_API pthread_mutexattr_setprioceiling(pthread_mutexattr_t *a, int prio);
378 int WINPTHREAD_API pthread_getconcurrency(void);
379 int WINPTHREAD_API pthread_setconcurrency(int new_level);
381 int WINPTHREAD_API pthread_condattr_destroy(pthread_condattr_t *a);
382 int WINPTHREAD_API pthread_condattr_init(pthread_condattr_t *a);
383 int WINPTHREAD_API pthread_condattr_getpshared(const pthread_condattr_t *a, int *s);
384 int WINPTHREAD_API pthread_condattr_setpshared(pthread_condattr_t *a, int s);
386 #ifndef __clockid_t_defined
387 typedef int clockid_t;
388 #define __clockid_t_defined 1
389 #endif /* __clockid_t_defined */
391 int WINPTHREAD_API pthread_condattr_getclock (const pthread_condattr_t *attr,
392 clockid_t *clock_id);
393 int WINPTHREAD_API pthread_condattr_setclock(pthread_condattr_t *attr,
395 int WINPTHREAD_API __pthread_clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp);
397 int WINPTHREAD_API pthread_barrierattr_init(void **attr);
398 int WINPTHREAD_API pthread_barrierattr_destroy(void **attr);
399 int WINPTHREAD_API pthread_barrierattr_setpshared(void **attr, int s);
400 int WINPTHREAD_API pthread_barrierattr_getpshared(void **attr, int *s);
402 /* Private extensions for analysis and internal use. */
403 struct _pthread_cleanup ** WINPTHREAD_API pthread_getclean (void);
404 void * WINPTHREAD_API pthread_gethandle (pthread_t t);
405 void * WINPTHREAD_API pthread_getevent (pthread_t t);
407 unsigned long long WINPTHREAD_API _pthread_rel_time_in_ms(const struct timespec *ts);
408 unsigned long long WINPTHREAD_API _pthread_time_in_ms(void);
409 unsigned long long WINPTHREAD_API _pthread_time_in_ms_from_timespec(const struct timespec *ts);
410 int WINPTHREAD_API _pthread_tryjoin (pthread_t t, void **res);
411 int WINPTHREAD_API pthread_delay_np (const struct timespec *interval);
412 int WINPTHREAD_API pthread_rwlockattr_destroy(pthread_rwlockattr_t *a);
413 int WINPTHREAD_API pthread_rwlockattr_getpshared(pthread_rwlockattr_t *a, int *s);
414 int WINPTHREAD_API pthread_rwlockattr_init(pthread_rwlockattr_t *a);
415 int WINPTHREAD_API pthread_rwlockattr_setpshared(pthread_rwlockattr_t *a, int s);
417 /* Recursive API emulation. */
419 #define localtime_r(_Time, _Tm) ({ struct tm *___tmp_tm; \
420 pthread_testcancel(); \
421 ___tmp_tm = localtime((_Time));\
423 *(_Tm) = *___tmp_tm; \
429 #define gmtime_r(_Time,_Tm) ({ struct tm *___tmp_tm; \
430 pthread_testcancel(); \
431 ___tmp_tm = gmtime((_Time)); \
433 *(_Tm) = *___tmp_tm; \
439 #define ctime_r(_Time,_Str) ({ char *___tmp_tm; \
440 pthread_testcancel(); \
441 ___tmp_tm = ctime((_Time)); \
444 strcpy((_Str),___tmp_tm); \
448 #define asctime_r(_Tm, _Buf) ({ char *___tmp_tm; \
449 pthread_testcancel(); \
450 ___tmp_tm = asctime((_Tm)); \
453 strcpy((_Buf),___tmp_tm);\
457 #define strtok_r(__s, __sep, __last) (*(__last) = strtok((__s), (__sep)))
460 #define rand_r(__seed) (__seed == __seed ? rand () : rand ())
467 #define SIG_UNBLOCK 1
470 #define SIG_SETMASK 2
473 #include <pthread_unistd.h>
475 #undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
476 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS PTHREAD_DESTRUCTOR_ITERATIONS
478 #undef _POSIX_THREAD_KEYS_MAX
479 #define _POSIX_THREAD_KEYS_MAX PTHREAD_KEYS_MAX
481 #undef PTHREAD_THREADS_MAX
482 #define PTHREAD_THREADS_MAX 2019
484 #undef _POSIX_SEM_NSEMS_MAX
485 #define _POSIX_SEM_NSEMS_MAX 256
488 #define SEM_NSEMS_MAX 1024
490 /* Wrap cancellation points. */
491 #ifdef __WINPTRHEAD_ENABLE_WRAP_API
492 #define accept(...) (pthread_testcancel(), accept(__VA_ARGS__))
493 #define aio_suspend(...) (pthread_testcancel(), aio_suspend(__VA_ARGS__))
494 #define clock_nanosleep(...) (pthread_testcancel(), clock_nanosleep(__VA_ARGS__))
495 #define close(...) (pthread_testcancel(), close(__VA_ARGS__))
496 #define connect(...) (pthread_testcancel(), connect(__VA_ARGS__))
497 #define creat(...) (pthread_testcancel(), creat(__VA_ARGS__))
498 #define fcntl(...) (pthread_testcancel(), fcntl(__VA_ARGS__))
499 #define fdatasync(...) (pthread_testcancel(), fdatasync(__VA_ARGS__))
500 #define fsync(...) (pthread_testcancel(), fsync(__VA_ARGS__))
501 #define getmsg(...) (pthread_testcancel(), getmsg(__VA_ARGS__))
502 #define getpmsg(...) (pthread_testcancel(), getpmsg(__VA_ARGS__))
503 #define lockf(...) (pthread_testcancel(), lockf(__VA_ARGS__))
504 #define mg_receive(...) (pthread_testcancel(), mg_receive(__VA_ARGS__))
505 #define mg_send(...) (pthread_testcancel(), mg_send(__VA_ARGS__))
506 #define mg_timedreceive(...) (pthread_testcancel(), mg_timedreceive(__VA_ARGS__))
507 #define mg_timessend(...) (pthread_testcancel(), mg_timedsend(__VA_ARGS__))
508 #define msgrcv(...) (pthread_testcancel(), msgrecv(__VA_ARGS__))
509 #define msgsnd(...) (pthread_testcancel(), msgsnd(__VA_ARGS__))
510 #define msync(...) (pthread_testcancel(), msync(__VA_ARGS__))
511 #define nanosleep(...) (pthread_testcancel(), nanosleep(__VA_ARGS__))
512 #define open(...) (pthread_testcancel(), open(__VA_ARGS__))
513 #define pause(...) (pthread_testcancel(), pause(__VA_ARGS__))
514 #define poll(...) (pthread_testcancel(), poll(__VA_ARGS__))
515 #define pread(...) (pthread_testcancel(), pread(__VA_ARGS__))
516 #define pselect(...) (pthread_testcancel(), pselect(__VA_ARGS__))
517 #define putmsg(...) (pthread_testcancel(), putmsg(__VA_ARGS__))
518 #define putpmsg(...) (pthread_testcancel(), putpmsg(__VA_ARGS__))
519 #define pwrite(...) (pthread_testcancel(), pwrite(__VA_ARGS__))
520 #define read(...) (pthread_testcancel(), read(__VA_ARGS__))
521 #define readv(...) (pthread_testcancel(), readv(__VA_ARGS__))
522 #define recv(...) (pthread_testcancel(), recv(__VA_ARGS__))
523 #define recvfrom(...) (pthread_testcancel(), recvfrom(__VA_ARGS__))
524 #define recvmsg(...) (pthread_testcancel(), recvmsg(__VA_ARGS__))
525 #define select(...) (pthread_testcancel(), select(__VA_ARGS__))
526 #define sem_timedwait(...) (pthread_testcancel(), sem_timedwait(__VA_ARGS__))
527 #define sem_wait(...) (pthread_testcancel(), sem_wait(__VA_ARGS__))
528 #define send(...) (pthread_testcancel(), send(__VA_ARGS__))
529 #define sendmsg(...) (pthread_testcancel(), sendmsg(__VA_ARGS__))
530 #define sendto(...) (pthread_testcancel(), sendto(__VA_ARGS__))
531 #define sigpause(...) (pthread_testcancel(), sigpause(__VA_ARGS__))
532 #define sigsuspend(...) (pthread_testcancel(), sigsuspend(__VA_ARGS__))
533 #define sigwait(...) (pthread_testcancel(), sigwait(__VA_ARGS__))
534 #define sigwaitinfo(...) (pthread_testcancel(), sigwaitinfo(__VA_ARGS__))
535 #define sleep(...) (pthread_testcancel(), sleep(__VA_ARGS__))
536 //#define Sleep(...) (pthread_testcancel(), Sleep(__VA_ARGS__))
537 #define system(...) (pthread_testcancel(), system(__VA_ARGS__))
538 #define access(...) (pthread_testcancel(), access(__VA_ARGS__))
539 #define asctime(...) (pthread_testcancel(), asctime(__VA_ARGS__))
540 #define catclose(...) (pthread_testcancel(), catclose(__VA_ARGS__))
541 #define catgets(...) (pthread_testcancel(), catgets(__VA_ARGS__))
542 #define catopen(...) (pthread_testcancel(), catopen(__VA_ARGS__))
543 #define closedir(...) (pthread_testcancel(), closedir(__VA_ARGS__))
544 #define closelog(...) (pthread_testcancel(), closelog(__VA_ARGS__))
545 #define ctermid(...) (pthread_testcancel(), ctermid(__VA_ARGS__))
546 #define ctime(...) (pthread_testcancel(), ctime(__VA_ARGS__))
547 #define dbm_close(...) (pthread_testcancel(), dbm_close(__VA_ARGS__))
548 #define dbm_delete(...) (pthread_testcancel(), dbm_delete(__VA_ARGS__))
549 #define dbm_fetch(...) (pthread_testcancel(), dbm_fetch(__VA_ARGS__))
550 #define dbm_nextkey(...) (pthread_testcancel(), dbm_nextkey(__VA_ARGS__))
551 #define dbm_open(...) (pthread_testcancel(), dbm_open(__VA_ARGS__))
552 #define dbm_store(...) (pthread_testcancel(), dbm_store(__VA_ARGS__))
553 #define dlclose(...) (pthread_testcancel(), dlclose(__VA_ARGS__))
554 #define dlopen(...) (pthread_testcancel(), dlopen(__VA_ARGS__))
555 #define endgrent(...) (pthread_testcancel(), endgrent(__VA_ARGS__))
556 #define endhostent(...) (pthread_testcancel(), endhostent(__VA_ARGS__))
557 #define endnetent(...) (pthread_testcancel(), endnetent(__VA_ARGS__))
558 #define endprotoent(...) (pthread_testcancel(), endprotoend(__VA_ARGS__))
559 #define endpwent(...) (pthread_testcancel(), endpwent(__VA_ARGS__))
560 #define endservent(...) (pthread_testcancel(), endservent(__VA_ARGS__))
561 #define endutxent(...) (pthread_testcancel(), endutxent(__VA_ARGS__))
562 #define fclose(...) (pthread_testcancel(), fclose(__VA_ARGS__))
563 #define fflush(...) (pthread_testcancel(), fflush(__VA_ARGS__))
564 #define fgetc(...) (pthread_testcancel(), fgetc(__VA_ARGS__))
565 #define fgetpos(...) (pthread_testcancel(), fgetpos(__VA_ARGS__))
566 #define fgets(...) (pthread_testcancel(), fgets(__VA_ARGS__))
567 #define fgetwc(...) (pthread_testcancel(), fgetwc(__VA_ARGS__))
568 #define fgetws(...) (pthread_testcancel(), fgetws(__VA_ARGS__))
569 #define fmtmsg(...) (pthread_testcancel(), fmtmsg(__VA_ARGS__))
570 #define fopen(...) (pthread_testcancel(), fopen(__VA_ARGS__))
571 #define fpathconf(...) (pthread_testcancel(), fpathconf(__VA_ARGS__))
572 #define fprintf(...) (pthread_testcancel(), fprintf(__VA_ARGS__))
573 #define fputc(...) (pthread_testcancel(), fputc(__VA_ARGS__))
574 #define fputs(...) (pthread_testcancel(), fputs(__VA_ARGS__))
575 #define fputwc(...) (pthread_testcancel(), fputwc(__VA_ARGS__))
576 #define fputws(...) (pthread_testcancel(), fputws(__VA_ARGS__))
577 #define fread(...) (pthread_testcancel(), fread(__VA_ARGS__))
578 #define freopen(...) (pthread_testcancel(), freopen(__VA_ARGS__))
579 #define fscanf(...) (pthread_testcancel(), fscanf(__VA_ARGS__))
580 #define fseek(...) (pthread_testcancel(), fseek(__VA_ARGS__))
581 #define fseeko(...) (pthread_testcancel(), fseeko(__VA_ARGS__))
582 #define fsetpos(...) (pthread_testcancel(), fsetpos(__VA_ARGS__))
583 #define fstat(...) (pthread_testcancel(), fstat(__VA_ARGS__))
584 #define ftell(...) (pthread_testcancel(), ftell(__VA_ARGS__))
585 #define ftello(...) (pthread_testcancel(), ftello(__VA_ARGS__))
586 #define ftw(...) (pthread_testcancel(), ftw(__VA_ARGS__))
587 #define fwprintf(...) (pthread_testcancel(), fwprintf(__VA_ARGS__))
588 #define fwrite(...) (pthread_testcancel(), fwrite(__VA_ARGS__))
589 #define fwscanf(...) (pthread_testcancel(), fwscanf(__VA_ARGS__))
590 #define getaddrinfo(...) (pthread_testcancel(), getaddrinfo(__VA_ARGS__))
591 #define getc(...) (pthread_testcancel(), getc(__VA_ARGS__))
592 #define getc_unlocked(...) (pthread_testcancel(), getc_unlocked(__VA_ARGS__))
593 #define getchar(...) (pthread_testcancel(), getchar(__VA_ARGS__))
594 #define getchar_unlocked(...) (pthread_testcancel(), getchar_unlocked(__VA_ARGS__))
595 #define getcwd(...) (pthread_testcancel(), getcwd(__VA_ARGS__))
596 #define getdate(...) (pthread_testcancel(), getdate(__VA_ARGS__))
597 #define getgrent(...) (pthread_testcancel(), getgrent(__VA_ARGS__))
598 #define getgrgid(...) (pthread_testcancel(), getgrgid(__VA_ARGS__))
599 #define getgrgid_r(...) (pthread_testcancel(), getgrgid_r(__VA_ARGS__))
600 #define gergrnam(...) (pthread_testcancel(), getgrnam(__VA_ARGS__))
601 #define getgrnam_r(...) (pthread_testcancel(), getgrnam_r(__VA_ARGS__))
602 #define gethostbyaddr(...) (pthread_testcancel(), gethostbyaddr(__VA_ARGS__))
603 #define gethostbyname(...) (pthread_testcancel(), gethostbyname(__VA_ARGS__))
604 #define gethostent(...) (pthread_testcancel(), gethostent(__VA_ARGS__))
605 #define gethostid(...) (pthread_testcancel(), gethostid(__VA_ARGS__))
606 #define gethostname(...) (pthread_testcancel(), gethostname(__VA_ARGS__))
607 #define getlogin(...) (pthread_testcancel(), getlogin(__VA_ARGS__))
608 #define getlogin_r(...) (pthread_testcancel(), getlogin_r(__VA_ARGS__))
609 #define getnameinfo(...) (pthread_testcancel(), getnameinfo(__VA_ARGS__))
610 #define getnetbyaddr(...) (pthread_testcancel(), getnetbyaddr(__VA_ARGS__))
611 #define getnetbyname(...) (pthread_testcancel(), getnetbyname(__VA_ARGS__))
612 #define getnetent(...) (pthread_testcancel(), getnetent(__VA_ARGS__))
613 #define getopt(...) (pthread_testcancel(), getopt(__VA_ARGS__))
614 #define getprotobyname(...) (pthread_testcancel(), getprotobyname(__VA_ARGS__))
615 #define getprotobynumber(...) (pthread_testcancel(), getprotobynumber(__VA_ARGS__))
616 #define getprotoent(...) (pthread_testcancel(), getprotoent(__VA_ARGS__))
617 #define getpwent(...) (pthread_testcancel(), getpwent(__VA_ARGS__))
618 #define getpwnam(...) (pthread_testcancel(), getpwnam(__VA_ARGS__))
619 #define getpwnam_r(...) (pthread_testcancel(), getpwnam_r(__VA_ARGS__))
620 #define getpwuid(...) (pthread_testcancel(), getpwuid(__VA_ARGS__))
621 #define getpwuid_r(...) (pthread_testcancel(), getpwuid_r(__VA_ARGS__))
622 #define gets(...) (pthread_testcancel(), gets(__VA_ARGS__))
623 #define getservbyname(...) (pthread_testcancel(), getservbyname(__VA_ARGS__))
624 #define getservbyport(...) (pthread_testcancel(), getservbyport(__VA_ARGS__))
625 #define getservent(...) (pthread_testcancel(), getservent(__VA_ARGS__))
626 #define getutxent(...) (pthread_testcancel(), getutxent(__VA_ARGS__))
627 #define getutxid(...) (pthread_testcancel(), getutxid(__VA_ARGS__))
628 #define getutxline(...) (pthread_testcancel(), getutxline(__VA_ARGS__))
630 #define getwc(...) (pthread_testcancel(), getwc(__VA_ARGS__))
632 #define getwchar(...) (pthread_testcancel(), getwchar(__VA_ARGS__))
633 #define getwd(...) (pthread_testcancel(), getwd(__VA_ARGS__))
634 #define glob(...) (pthread_testcancel(), glob(__VA_ARGS__))
635 #define iconv_close(...) (pthread_testcancel(), iconv_close(__VA_ARGS__))
636 #define iconv_open(...) (pthread_testcancel(), iconv_open(__VA_ARGS__))
637 #define ioctl(...) (pthread_testcancel(), ioctl(__VA_ARGS__))
638 #define link(...) (pthread_testcancel(), link(__VA_ARGS__))
639 #define localtime(...) (pthread_testcancel(), localtime(__VA_ARGS__))
640 #define lseek(...) (pthread_testcancel(), lseek(__VA_ARGS__))
641 #define lstat(...) (pthread_testcancel(), lstat(__VA_ARGS__))
642 #define mkstemp(...) (pthread_testcancel(), mkstemp(__VA_ARGS__))
643 #define nftw(...) (pthread_testcancel(), nftw(__VA_ARGS__))
644 #define opendir(...) (pthread_testcancel(), opendir(__VA_ARGS__))
645 #define openlog(...) (pthread_testcancel(), openlog(__VA_ARGS__))
646 #define pathconf(...) (pthread_testcancel(), pathconf(__VA_ARGS__))
647 #define pclose(...) (pthread_testcancel(), pclose(__VA_ARGS__))
648 #define perror(...) (pthread_testcancel(), perror(__VA_ARGS__))
649 #define popen(...) (pthread_testcancel(), popen(__VA_ARGS__))
650 #define posix_fadvise(...) (pthread_testcancel(), posix_fadvise(__VA_ARGS__))
651 #define posix_fallocate(...) (pthread_testcancel(), posix_fallocate(__VA_ARGS__))
652 #define posix_madvise(...) (pthread_testcancel(), posix_madvise(__VA_ARGS__))
653 #define posix_openpt(...) (pthread_testcancel(), posix_openpt(__VA_ARGS__))
654 #define posix_spawn(...) (pthread_testcancel(), posix_spawn(__VA_ARGS__))
655 #define posix_spawnp(...) (pthread_testcancel(), posix_spawnp(__VA_ARGS__))
656 #define posix_trace_clear(...) (pthread_testcancel(), posix_trace_clear(__VA_ARGS__))
657 #define posix_trace_close(...) (pthread_testcancel(), posix_trace_close(__VA_ARGS__))
658 #define posix_trace_create(...) (pthread_testcancel(), posix_trace_create(__VA_ARGS__))
659 #define posix_trace_create_withlog(...) (pthread_testcancel(), posix_trace_create_withlog(__VA_ARGS__))
660 #define posix_trace_eventtypelist_getne(...) (pthread_testcancel(), posix_trace_eventtypelist_getne(__VA_ARGS__))
661 #define posix_trace_eventtypelist_rewin(...) (pthread_testcancel(), posix_trace_eventtypelist_rewin(__VA_ARGS__))
662 #define posix_trace_flush(...) (pthread_testcancel(), posix_trace_flush(__VA_ARGS__))
663 #define posix_trace_get_attr(...) (pthread_testcancel(), posix_trace_get_attr(__VA_ARGS__))
664 #define posix_trace_get_filter(...) (pthread_testcancel(), posix_trace_get_filter(__VA_ARGS__))
665 #define posix_trace_get_status(...) (pthread_testcancel(), posix_trace_get_status(__VA_ARGS__))
666 #define posix_trace_getnext_event(...) (pthread_testcancel(), posix_trace_getnext_event(__VA_ARGS__))
667 #define posix_trace_open(...) (pthread_testcancel(), posix_trace_open(__VA_ARGS__))
668 #define posix_trace_rewind(...) (pthread_testcancel(), posix_trace_rewind(__VA_ARGS__))
669 #define posix_trace_setfilter(...) (pthread_testcancel(), posix_trace_setfilter(__VA_ARGS__))
670 #define posix_trace_shutdown(...) (pthread_testcancel(), posix_trace_shutdown(__VA_ARGS__))
671 #define posix_trace_timedgetnext_event(...) (pthread_testcancel(), posix_trace_timedgetnext_event(__VA_ARGS__))
672 #define posix_typed_mem_open(...) (pthread_testcancel(), posix_typed_mem_open(__VA_ARGS__))
673 #define printf(...) (pthread_testcancel(), printf(__VA_ARGS__))
674 #define putc(...) (pthread_testcancel(), putc(__VA_ARGS__))
675 #define putc_unlocked(...) (pthread_testcancel(), putc_unlocked(__VA_ARGS__))
676 #define putchar(...) (pthread_testcancel(), putchar(__VA_ARGS__))
677 #define putchar_unlocked(...) (pthread_testcancel(), putchar_unlocked(__VA_ARGS__))
678 #define puts(...) (pthread_testcancel(), puts(__VA_ARGS__))
679 #define pututxline(...) (pthread_testcancel(), pututxline(__VA_ARGS__))
681 #define putwc(...) (pthread_testcancel(), putwc(__VA_ARGS__))
683 #define putwchar(...) (pthread_testcancel(), putwchar(__VA_ARGS__))
684 #define readdir(...) (pthread_testcancel(), readdir(__VA_ARSG__))
685 #define readdir_r(...) (pthread_testcancel(), readdir_r(__VA_ARGS__))
686 #define remove(...) (pthread_testcancel(), remove(__VA_ARGS__))
687 #define rename(...) (pthread_testcancel(), rename(__VA_ARGS__))
688 #define rewind(...) (pthread_testcancel(), rewind(__VA_ARGS__))
689 #define rewinddir(...) (pthread_testcancel(), rewinddir(__VA_ARGS__))
690 #define scanf(...) (pthread_testcancel(), scanf(__VA_ARGS__))
691 #define seekdir(...) (pthread_testcancel(), seekdir(__VA_ARGS__))
692 #define semop(...) (pthread_testcancel(), semop(__VA_ARGS__))
693 #define setgrent(...) (pthread_testcancel(), setgrent(__VA_ARGS__))
694 #define sethostent(...) (pthread_testcancel(), sethostemt(__VA_ARGS__))
695 #define setnetent(...) (pthread_testcancel(), setnetent(__VA_ARGS__))
696 #define setprotoent(...) (pthread_testcancel(), setprotoent(__VA_ARGS__))
697 #define setpwent(...) (pthread_testcancel(), setpwent(__VA_ARGS__))
698 #define setservent(...) (pthread_testcancel(), setservent(__VA_ARGS__))
699 #define setutxent(...) (pthread_testcancel(), setutxent(__VA_ARGS__))
700 #define stat(...) (pthread_testcancel(), stat(__VA_ARGS__))
701 #define strerror(...) (pthread_testcancel(), strerror(__VA_ARGS__))
702 #define strerror_r(...) (pthread_testcancel(), strerror_r(__VA_ARGS__))
703 #define strftime(...) (pthread_testcancel(), strftime(__VA_ARGS__))
704 #define symlink(...) (pthread_testcancel(), symlink(__VA_ARGS__))
705 #define sync(...) (pthread_testcancel(), sync(__VA_ARGS__))
706 #define syslog(...) (pthread_testcancel(), syslog(__VA_ARGS__))
707 #define tmpfile(...) (pthread_testcancel(), tmpfile(__VA_ARGS__))
708 #define tmpnam(...) (pthread_testcancel(), tmpnam(__VA_ARGS__))
709 #define ttyname(...) (pthread_testcancel(), ttyname(__VA_ARGS__))
710 #define ttyname_r(...) (pthread_testcancel(), ttyname_r(__VA_ARGS__))
711 #define tzset(...) (pthread_testcancel(), tzset(__VA_ARGS__))
712 #define ungetc(...) (pthread_testcancel(), ungetc(__VA_ARGS__))
713 #define ungetwc(...) (pthread_testcancel(), ungetwc(__VA_ARGS__))
714 #define unlink(...) (pthread_testcancel(), unlink(__VA_ARGS__))
715 #define vfprintf(...) (pthread_testcancel(), vfprintf(__VA_ARGS__))
716 #define vfwprintf(...) (pthread_testcancel(), vfwprintf(__VA_ARGS__))
717 #define vprintf(...) (pthread_testcancel(), vprintf(__VA_ARGS__))
718 #define vwprintf(...) (pthread_testcancel(), vwprintf(__VA_ARGS__))
719 #define wcsftime(...) (pthread_testcancel(), wcsftime(__VA_ARGS__))
720 #define wordexp(...) (pthread_testcancel(), wordexp(__VA_ARGS__))
721 #define wprintf(...) (pthread_testcancel(), wprintf(__VA_ARGS__))
722 #define wscanf(...) (pthread_testcancel(), wscanf(__VA_ARGS__))
729 #endif /* WIN_PTHREADS_H */