| 1 | /* |
| 2 | Copyright (c) 2011-2016 mingw-w64 project |
| 3 | |
| 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: |
| 10 | |
| 11 | The above copyright notice and this permission notice shall be included in |
| 12 | all copies or substantial portions of the Software. |
| 13 | |
| 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. |
| 21 | */ |
| 22 | |
| 23 | /* |
| 24 | * Parts of this library are derived by: |
| 25 | * |
| 26 | * Posix Threads library for Microsoft Windows |
| 27 | * |
| 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. |
| 31 | * |
| 32 | * (C) 2010 Lockless Inc. |
| 33 | * All rights reserved. |
| 34 | * |
| 35 | * Redistribution and use in source and binary forms, with or without modification, |
| 36 | * are permitted provided that the following conditions are met: |
| 37 | * |
| 38 | * |
| 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. |
| 47 | * |
| 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. |
| 58 | */ |
| 59 | #ifndef WIN_PTHREADS_H |
| 60 | #define WIN_PTHREADS_H |
| 61 | |
| 62 | #include <stddef.h> |
| 63 | #include <errno.h> |
| 64 | #include <sys/types.h> |
| 65 | |
| 66 | #include <process.h> |
| 67 | #include <limits.h> |
| 68 | #include <signal.h> |
| 69 | #include <time.h> |
| 70 | |
| 71 | #include "pthread_compat.h" |
| 72 | #include "sched.h" |
| 73 | |
| 74 | #ifdef _MSC_VER |
| 75 | #include "pthread_time.h" |
| 76 | #endif |
| 77 | |
| 78 | #ifdef __cplusplus |
| 79 | extern "C" { |
| 80 | #endif |
| 81 | |
| 82 | #define __WINPTHREADS_VERSION_MAJOR 0 |
| 83 | #define __WINPTHREADS_VERSION_MINOR 5 |
| 84 | #define __WINPTHREADS_VERSION_PATCHLEVEL 0 |
| 85 | |
| 86 | /* MSB 8-bit major version, 8-bit minor version, 16-bit patch level. */ |
| 87 | #define __WINPTHREADS_VERSION 0x00050000 |
| 88 | |
| 89 | /* Compatibility stuff: */ |
| 90 | #define RWLS_PER_THREAD						8 |
| 91 | |
| 92 | /* pthread specific defines. */ |
| 93 | |
| 94 | #define PTHREAD_CANCEL_DISABLE 0 |
| 95 | #define PTHREAD_CANCEL_ENABLE 0x01 |
| 96 | |
| 97 | #define PTHREAD_CANCEL_DEFERRED 0 |
| 98 | #define PTHREAD_CANCEL_ASYNCHRONOUS 0x02 |
| 99 | |
| 100 | #define PTHREAD_CREATE_JOINABLE 0 |
| 101 | #define PTHREAD_CREATE_DETACHED 0x04 |
| 102 | |
| 103 | #define PTHREAD_EXPLICIT_SCHED 0 |
| 104 | #define PTHREAD_INHERIT_SCHED 0x08 |
| 105 | |
| 106 | #define PTHREAD_SCOPE_PROCESS 0 |
| 107 | #define PTHREAD_SCOPE_SYSTEM 0x10 |
| 108 | |
| 109 | #define PTHREAD_DEFAULT_ATTR (PTHREAD_CANCEL_ENABLE) |
| 110 | |
| 111 | #define PTHREAD_CANCELED ((void *) (intptr_t) 0xDEADBEEF) |
| 112 | |
| 113 | #define _PTHREAD_NULL_THREAD ((pthread_t) 0) |
| 114 | |
| 115 | #define PTHREAD_ONCE_INIT 0 |
| 116 | |
| 117 | #define PTHREAD_DESTRUCTOR_ITERATIONS 256 |
| 118 | #define PTHREAD_KEYS_MAX (1<<20) |
| 119 | |
| 120 | #define PTHREAD_MUTEX_NORMAL 0 |
| 121 | #define PTHREAD_MUTEX_ERRORCHECK 1 |
| 122 | #define PTHREAD_MUTEX_RECURSIVE 2 |
| 123 | #define PTHREAD_MUTEX_DEFAULT PTHREAD_MUTEX_NORMAL |
| 124 | |
| 125 | #define PTHREAD_MUTEX_SHARED 1 |
| 126 | #define PTHREAD_MUTEX_PRIVATE 0 |
| 127 | |
| 128 | #define PTHREAD_PRIO_NONE 0 |
| 129 | #define PTHREAD_PRIO_INHERIT 8 |
| 130 | #define PTHREAD_PRIO_PROTECT 16 |
| 131 | #define PTHREAD_PRIO_MULT 32 |
| 132 | #define PTHREAD_PROCESS_SHARED 1 |
| 133 | #define PTHREAD_PROCESS_PRIVATE 0 |
| 134 | |
| 135 | #define PTHREAD_MUTEX_FAST_NP		PTHREAD_MUTEX_NORMAL |
| 136 | #define PTHREAD_MUTEX_TIMED_NP		PTHREAD_MUTEX_FAST_NP |
| 137 | #define PTHREAD_MUTEX_ADAPTIVE_NP	PTHREAD_MUTEX_FAST_NP |
| 138 | #define PTHREAD_MUTEX_ERRORCHECK_NP	PTHREAD_MUTEX_ERRORCHECK |
| 139 | #define PTHREAD_MUTEX_RECURSIVE_NP	PTHREAD_MUTEX_RECURSIVE |
| 140 | |
| 141 | WINPTHREAD_API void * pthread_timechange_handler_np(void * dummy); |
| 142 | WINPTHREAD_API int pthread_delay32_np (const struct _timespec32 *interval); |
| 143 | WINPTHREAD_API int pthread_delay64_np (const struct _timespec64 *interval); |
| 144 | WINPTHREAD_THREAD_DECL int pthread_delay_np (const struct timespec *interval) |
| 145 | { |
| 146 | #if WINPTHREADS_TIME_BITS == 32 |
| 147 | return pthread_delay32_np ((const struct _timespec32 *) interval); |
| 148 | #else |
| 149 | return pthread_delay64_np ((const struct _timespec64 *) interval); |
| 150 | #endif |
| 151 | } |
| 152 | WINPTHREAD_API int pthread_num_processors_np(void); |
| 153 | WINPTHREAD_API int pthread_set_num_processors_np(int n); |
| 154 | |
| 155 | #define PTHREAD_BARRIER_SERIAL_THREAD 1 |
| 156 | |
| 157 | /* maximum number of times a read lock may be obtained */ |
| 158 | #define	MAX_READ_LOCKS		(INT_MAX - 1) |
| 159 | |
| 160 | /* No fork() in windows - so ignore this */ |
| 161 | #define pthread_atfork(F1,F2,F3) 0 |
| 162 | |
| 163 | /* unsupported stuff: */ |
| 164 | #define pthread_mutex_getprioceiling(M, P) ENOTSUP |
| 165 | #define pthread_mutex_setprioceiling(M, P) ENOTSUP |
| 166 | #define pthread_getcpuclockid(T, C) ENOTSUP |
| 167 | #define pthread_attr_getguardsize(A, S) ENOTSUP |
| 168 | #define pthread_attr_setguardsize(A, S) ENOTSUP |
| 169 | |
| 170 | typedef long pthread_once_t; |
| 171 | typedef unsigned pthread_mutexattr_t; |
| 172 | typedef unsigned pthread_key_t; |
| 173 | typedef void *pthread_barrierattr_t; |
| 174 | typedef int pthread_condattr_t; |
| 175 | typedef int pthread_rwlockattr_t; |
| 176 | typedef uintptr_t pthread_t; |
| 177 | |
| 178 | typedef struct _pthread_cleanup _pthread_cleanup; |
| 179 | struct _pthread_cleanup |
| 180 | { |
| 181 | void (*func)(void *); |
| 182 | void *arg; |
| 183 | _pthread_cleanup *next; |
| 184 | }; |
| 185 | |
| 186 | /* Using MemoryBarrier() requires including Windows headers. User code |
| 187 | * may want to use pthread_cleanup_push without including Windows headers |
| 188 | * first, thus prefer GCC specific intrinsics where possible. */ |
| 189 | #ifdef __GNUC__ |
| 190 | #define __pthread_MemoryBarrier() __sync_synchronize() |
| 191 | #else |
| 192 | #define __pthread_MemoryBarrier() MemoryBarrier() |
| 193 | #endif |
| 194 | |
| 195 | #define pthread_cleanup_push(F, A) \ |
| 196 | do { \ |
| 197 | const _pthread_cleanup _pthread_cup = \ |
| 198 | { (F), (A), *pthread_getclean() }; \ |
| 199 | __pthread_MemoryBarrier(); \ |
| 200 | *pthread_getclean() = (_pthread_cleanup *) &_pthread_cup; \ |
| 201 | __pthread_MemoryBarrier(); \ |
| 202 | do { \ |
| 203 | do {} while (0) |
| 204 | |
| 205 | /* Note that if async cancelling is used, then there is a race here */ |
| 206 | #define pthread_cleanup_pop(E) \ |
| 207 | } while (0); \ |
| 208 | *pthread_getclean() = _pthread_cup.next; \ |
| 209 | if ((E)) _pthread_cup.func((pthread_once_t *)_pthread_cup.arg); \ |
| 210 | } while (0) |
| 211 | |
| 212 | typedef struct pthread_attr_t pthread_attr_t; |
| 213 | struct pthread_attr_t |
| 214 | { |
| 215 | unsigned p_state; |
| 216 | void *stack; |
| 217 | size_t s_size; |
| 218 | struct sched_param param; |
| 219 | }; |
| 220 | |
| 221 | WINPTHREAD_API int pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param); |
| 222 | WINPTHREAD_API int pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param); |
| 223 | WINPTHREAD_API int pthread_getschedparam(pthread_t thread, int *pol, struct sched_param *param); |
| 224 | WINPTHREAD_API int pthread_setschedparam(pthread_t thread, int pol, const struct sched_param *param); |
| 225 | WINPTHREAD_API int pthread_attr_setschedpolicy (pthread_attr_t *attr, int pol); |
| 226 | WINPTHREAD_API int pthread_attr_getschedpolicy (const pthread_attr_t *attr, int *pol); |
| 227 | |
| 228 | /* synchronization objects */ |
| 229 | typedef intptr_t pthread_spinlock_t; |
| 230 | typedef intptr_t pthread_mutex_t; |
| 231 | typedef intptr_t pthread_cond_t; |
| 232 | typedef intptr_t pthread_rwlock_t; |
| 233 | typedef void	*pthread_barrier_t; |
| 234 | |
| 235 | #define PTHREAD_MUTEX_NORMAL 0 |
| 236 | #define PTHREAD_MUTEX_ERRORCHECK 1 |
| 237 | #define PTHREAD_MUTEX_RECURSIVE 2 |
| 238 | |
| 239 | #define GENERIC_INITIALIZER				-1 |
| 240 | #define GENERIC_ERRORCHECK_INITIALIZER			-2 |
| 241 | #define GENERIC_RECURSIVE_INITIALIZER			-3 |
| 242 | #define GENERIC_NORMAL_INITIALIZER			-1 |
| 243 | #define PTHREAD_MUTEX_INITIALIZER			(pthread_mutex_t)GENERIC_INITIALIZER |
| 244 | #define PTHREAD_RECURSIVE_MUTEX_INITIALIZER		(pthread_mutex_t)GENERIC_RECURSIVE_INITIALIZER |
| 245 | #define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER		(pthread_mutex_t)GENERIC_ERRORCHECK_INITIALIZER |
| 246 | #define PTHREAD_NORMAL_MUTEX_INITIALIZER		(pthread_mutex_t)GENERIC_NORMAL_INITIALIZER |
| 247 | #define PTHREAD_DEFAULT_MUTEX_INITIALIZER		PTHREAD_NORMAL_MUTEX_INITIALIZER |
| 248 | #define PTHREAD_COND_INITIALIZER			(pthread_cond_t)GENERIC_INITIALIZER |
| 249 | #define PTHREAD_RWLOCK_INITIALIZER			(pthread_rwlock_t)GENERIC_INITIALIZER |
| 250 | #define PTHREAD_SPINLOCK_INITIALIZER			(pthread_spinlock_t)GENERIC_INITIALIZER |
| 251 | |
| 252 | WINPTHREAD_API extern void (**_pthread_key_dest)(void *); |
| 253 | WINPTHREAD_API int pthread_key_create(pthread_key_t *key, void (* dest)(void *)); |
| 254 | WINPTHREAD_API int pthread_key_delete(pthread_key_t key); |
| 255 | WINPTHREAD_API void * pthread_getspecific(pthread_key_t key); |
| 256 | WINPTHREAD_API int pthread_setspecific(pthread_key_t key, const void *value); |
| 257 | |
| 258 | WINPTHREAD_API pthread_t pthread_self(void); |
| 259 | WINPTHREAD_API int pthread_once(pthread_once_t *o, void (*func)(void)); |
| 260 | WINPTHREAD_API void pthread_testcancel(void); |
| 261 | WINPTHREAD_API int pthread_equal(pthread_t t1, pthread_t t2); |
| 262 | WINPTHREAD_API void pthread_tls_init(void); |
| 263 | WINPTHREAD_API void _pthread_cleanup_dest(pthread_t t); |
| 264 | WINPTHREAD_API int pthread_get_concurrency(int *val); |
| 265 | WINPTHREAD_API int pthread_set_concurrency(int val); |
| 266 | WINPTHREAD_API void pthread_exit(void *res); |
| 267 | WINPTHREAD_API void _pthread_invoke_cancel(void); |
| 268 | WINPTHREAD_API int pthread_cancel(pthread_t t); |
| 269 | WINPTHREAD_API int pthread_kill(pthread_t t, int sig); |
| 270 | WINPTHREAD_API unsigned _pthread_get_state(const pthread_attr_t *attr, unsigned flag); |
| 271 | WINPTHREAD_API int _pthread_set_state(pthread_attr_t *attr, unsigned flag, unsigned val); |
| 272 | WINPTHREAD_API int pthread_setcancelstate(int state, int *oldstate); |
| 273 | WINPTHREAD_API int pthread_setcanceltype(int type, int *oldtype); |
| 274 | WINPTHREAD_API unsigned __stdcall pthread_create_wrapper(void *args); |
| 275 | WINPTHREAD_API int pthread_create(pthread_t *th, const pthread_attr_t *attr, void *(* func)(void *), void *arg); |
| 276 | WINPTHREAD_API int pthread_join(pthread_t t, void **res); |
| 277 | WINPTHREAD_API int pthread_detach(pthread_t t); |
| 278 | WINPTHREAD_API int pthread_setname_np(pthread_t thread, const char *name); |
| 279 | WINPTHREAD_API int pthread_getname_np(pthread_t thread, char *name, size_t len); |
| 280 | |
| 281 | WINPTHREAD_API int pthread_rwlock_init(pthread_rwlock_t *rwlock_, const pthread_rwlockattr_t *attr); |
| 282 | WINPTHREAD_API int pthread_rwlock_wrlock(pthread_rwlock_t *l); |
| 283 | WINPTHREAD_API int pthread_rwlock_timedwrlock32(pthread_rwlock_t *rwlock, const struct _timespec32 *ts); |
| 284 | WINPTHREAD_API int pthread_rwlock_timedwrlock64(pthread_rwlock_t *rwlock, const struct _timespec64 *ts); |
| 285 | WINPTHREAD_RWLOCK_DECL int pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *ts) |
| 286 | { |
| 287 | #if WINPTHREADS_TIME_BITS == 32 |
| 288 | return pthread_rwlock_timedwrlock32 (rwlock, (const struct _timespec32 *) ts); |
| 289 | #else |
| 290 | return pthread_rwlock_timedwrlock64 (rwlock, (const struct _timespec64 *) ts); |
| 291 | #endif |
| 292 | } |
| 293 | WINPTHREAD_API int pthread_rwlock_rdlock(pthread_rwlock_t *l); |
| 294 | WINPTHREAD_API int pthread_rwlock_timedrdlock32(pthread_rwlock_t *l, const struct _timespec32 *ts); |
| 295 | WINPTHREAD_API int pthread_rwlock_timedrdlock64(pthread_rwlock_t *l, const struct _timespec64 *ts); |
| 296 | WINPTHREAD_RWLOCK_DECL int pthread_rwlock_timedrdlock(pthread_rwlock_t *l, const struct timespec *ts) |
| 297 | { |
| 298 | #if WINPTHREADS_TIME_BITS == 32 |
| 299 | return pthread_rwlock_timedrdlock32 (l, (const struct _timespec32 *) ts); |
| 300 | #else |
| 301 | return pthread_rwlock_timedrdlock64 (l, (const struct _timespec64 *) ts); |
| 302 | #endif |
| 303 | } |
| 304 | WINPTHREAD_API int pthread_rwlock_unlock(pthread_rwlock_t *l); |
| 305 | WINPTHREAD_API int pthread_rwlock_tryrdlock(pthread_rwlock_t *l); |
| 306 | WINPTHREAD_API int pthread_rwlock_trywrlock(pthread_rwlock_t *l); |
| 307 | WINPTHREAD_API int pthread_rwlock_destroy (pthread_rwlock_t *l); |
| 308 | |
| 309 | WINPTHREAD_API int pthread_cond_init(pthread_cond_t *cv, const pthread_condattr_t *a); |
| 310 | WINPTHREAD_API int pthread_cond_destroy(pthread_cond_t *cv); |
| 311 | WINPTHREAD_API int pthread_cond_signal (pthread_cond_t *cv); |
| 312 | WINPTHREAD_API int pthread_cond_broadcast (pthread_cond_t *cv); |
| 313 | WINPTHREAD_API int pthread_cond_wait (pthread_cond_t *cv, pthread_mutex_t *external_mutex); |
| 314 | WINPTHREAD_API int pthread_cond_timedwait32(pthread_cond_t *cv, pthread_mutex_t *external_mutex, const struct _timespec32 *t); |
| 315 | WINPTHREAD_API int pthread_cond_timedwait64(pthread_cond_t *cv, pthread_mutex_t *external_mutex, const struct _timespec64 *t); |
| 316 | WINPTHREAD_COND_DECL int pthread_cond_timedwait(pthread_cond_t *cv, pthread_mutex_t *external_mutex, const struct timespec *t) |
| 317 | { |
| 318 | #if WINPTHREADS_TIME_BITS == 32 |
| 319 | return pthread_cond_timedwait32 (cv, external_mutex, (const struct _timespec32 *) t); |
| 320 | #else |
| 321 | return pthread_cond_timedwait64 (cv, external_mutex, (const struct _timespec64 *) t); |
| 322 | #endif |
| 323 | } |
| 324 | WINPTHREAD_API int pthread_cond_timedwait32_relative_np(pthread_cond_t *cv, pthread_mutex_t *external_mutex, const struct _timespec32 *t); |
| 325 | WINPTHREAD_API int pthread_cond_timedwait64_relative_np(pthread_cond_t *cv, pthread_mutex_t *external_mutex, const struct _timespec64 *t); |
| 326 | WINPTHREAD_COND_DECL int pthread_cond_timedwait_relative_np(pthread_cond_t *cv, pthread_mutex_t *external_mutex, const struct timespec *t) |
| 327 | { |
| 328 | #if WINPTHREADS_TIME_BITS == 32 |
| 329 | return pthread_cond_timedwait32_relative_np (cv, external_mutex, (const struct _timespec32 *) t); |
| 330 | #else |
| 331 | return pthread_cond_timedwait64_relative_np (cv, external_mutex, (const struct _timespec64 *) t); |
| 332 | #endif |
| 333 | } |
| 334 | |
| 335 | WINPTHREAD_API int pthread_mutex_lock(pthread_mutex_t *m); |
| 336 | WINPTHREAD_API int pthread_mutex_timedlock32(pthread_mutex_t *m, const struct _timespec32 *ts); |
| 337 | WINPTHREAD_API int pthread_mutex_timedlock64(pthread_mutex_t *m, const struct _timespec64 *ts); |
| 338 | WINPTHREAD_MUTEX_DECL int pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec *ts) |
| 339 | { |
| 340 | #if WINPTHREADS_TIME_BITS == 32 |
| 341 | return pthread_mutex_timedlock32 (m, (const struct _timespec32 *) ts); |
| 342 | #else |
| 343 | return pthread_mutex_timedlock64 (m, (const struct _timespec64 *) ts); |
| 344 | #endif |
| 345 | } |
| 346 | WINPTHREAD_API int pthread_mutex_unlock(pthread_mutex_t *m); |
| 347 | WINPTHREAD_API int pthread_mutex_trylock(pthread_mutex_t *m); |
| 348 | WINPTHREAD_API int pthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *a); |
| 349 | WINPTHREAD_API int pthread_mutex_destroy(pthread_mutex_t *m); |
| 350 | |
| 351 | WINPTHREAD_API int pthread_barrier_destroy(pthread_barrier_t *b); |
| 352 | WINPTHREAD_API int pthread_barrier_init(pthread_barrier_t *b, const void *attr, unsigned int count); |
| 353 | WINPTHREAD_API int pthread_barrier_wait(pthread_barrier_t *b); |
| 354 | |
| 355 | WINPTHREAD_API int pthread_spin_init(pthread_spinlock_t *l, int pshared); |
| 356 | WINPTHREAD_API int pthread_spin_destroy(pthread_spinlock_t *l); |
| 357 | /* No-fair spinlock due to lack of knowledge of thread number. */ |
| 358 | WINPTHREAD_API int pthread_spin_lock(pthread_spinlock_t *l); |
| 359 | WINPTHREAD_API int pthread_spin_trylock(pthread_spinlock_t *l); |
| 360 | WINPTHREAD_API int pthread_spin_unlock(pthread_spinlock_t *l); |
| 361 | |
| 362 | WINPTHREAD_API int pthread_attr_init(pthread_attr_t *attr); |
| 363 | WINPTHREAD_API int pthread_attr_destroy(pthread_attr_t *attr); |
| 364 | WINPTHREAD_API int pthread_attr_setdetachstate(pthread_attr_t *a, int flag); |
| 365 | WINPTHREAD_API int pthread_attr_getdetachstate(const pthread_attr_t *a, int *flag); |
| 366 | WINPTHREAD_API int pthread_attr_setinheritsched(pthread_attr_t *a, int flag); |
| 367 | WINPTHREAD_API int pthread_attr_getinheritsched(const pthread_attr_t *a, int *flag); |
| 368 | WINPTHREAD_API int pthread_attr_setscope(pthread_attr_t *a, int flag); |
| 369 | WINPTHREAD_API int pthread_attr_getscope(const pthread_attr_t *a, int *flag); |
| 370 | WINPTHREAD_API int pthread_attr_getstack(const pthread_attr_t *attr, void **stack, size_t *size); |
| 371 | WINPTHREAD_API int pthread_attr_setstack(pthread_attr_t *attr, void *stack, size_t size); |
| 372 | WINPTHREAD_API int pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stack); |
| 373 | WINPTHREAD_API int pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack); |
| 374 | WINPTHREAD_API int pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *size); |
| 375 | WINPTHREAD_API int pthread_attr_setstacksize(pthread_attr_t *attr, size_t size); |
| 376 | |
| 377 | WINPTHREAD_API int pthread_mutexattr_init(pthread_mutexattr_t *a); |
| 378 | WINPTHREAD_API int pthread_mutexattr_destroy(pthread_mutexattr_t *a); |
| 379 | WINPTHREAD_API int pthread_mutexattr_gettype(const pthread_mutexattr_t *a, int *type); |
| 380 | WINPTHREAD_API int pthread_mutexattr_settype(pthread_mutexattr_t *a, int type); |
| 381 | WINPTHREAD_API int pthread_mutexattr_getpshared(const pthread_mutexattr_t *a, int *type); |
| 382 | WINPTHREAD_API int pthread_mutexattr_setpshared(pthread_mutexattr_t * a, int type); |
| 383 | WINPTHREAD_API int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *a, int *type); |
| 384 | WINPTHREAD_API int pthread_mutexattr_setprotocol(pthread_mutexattr_t *a, int type); |
| 385 | WINPTHREAD_API int pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *a, int * prio); |
| 386 | WINPTHREAD_API int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *a, int prio); |
| 387 | WINPTHREAD_API int pthread_getconcurrency(void); |
| 388 | WINPTHREAD_API int pthread_setconcurrency(int new_level); |
| 389 | |
| 390 | WINPTHREAD_API int pthread_condattr_destroy(pthread_condattr_t *a); |
| 391 | WINPTHREAD_API int pthread_condattr_init(pthread_condattr_t *a); |
| 392 | WINPTHREAD_API int pthread_condattr_getpshared(const pthread_condattr_t *a, int *s); |
| 393 | WINPTHREAD_API int pthread_condattr_setpshared(pthread_condattr_t *a, int s); |
| 394 | |
| 395 | WINPTHREAD_API int pthread_condattr_getclock (const pthread_condattr_t *attr, |
| 396 | clockid_t *clock_id); |
| 397 | WINPTHREAD_API int pthread_condattr_setclock(pthread_condattr_t *attr, |
| 398 | clockid_t clock_id); |
| 399 | |
| 400 | WINPTHREAD_API int pthread_barrierattr_init(void **attr); |
| 401 | WINPTHREAD_API int pthread_barrierattr_destroy(void **attr); |
| 402 | WINPTHREAD_API int pthread_barrierattr_setpshared(void **attr, int s); |
| 403 | WINPTHREAD_API int pthread_barrierattr_getpshared(void **attr, int *s); |
| 404 | |
| 405 | /* Private extensions for analysis and internal use. */ |
| 406 | WINPTHREAD_API struct _pthread_cleanup ** pthread_getclean (void); |
| 407 | WINPTHREAD_API void * pthread_gethandle (pthread_t t); |
| 408 | WINPTHREAD_API void * pthread_getevent (void); |
| 409 | |
| 410 | WINPTHREAD_API int _pthread_tryjoin (pthread_t t, void **res); |
| 411 | WINPTHREAD_API int pthread_rwlockattr_destroy(pthread_rwlockattr_t *a); |
| 412 | WINPTHREAD_API int pthread_rwlockattr_getpshared(pthread_rwlockattr_t *a, int *s); |
| 413 | WINPTHREAD_API int pthread_rwlockattr_init(pthread_rwlockattr_t *a); |
| 414 | WINPTHREAD_API int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *a, int s); |
| 415 | |
| 416 | #ifndef SIG_BLOCK |
| 417 | #define SIG_BLOCK 0 |
| 418 | #endif |
| 419 | #ifndef SIG_UNBLOCK |
| 420 | #define SIG_UNBLOCK 1 |
| 421 | #endif |
| 422 | #ifndef SIG_SETMASK |
| 423 | #define SIG_SETMASK 2 |
| 424 | #endif |
| 425 | |
| 426 | #include <pthread_unistd.h> |
| 427 | |
| 428 | #undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS |
| 429 | #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS PTHREAD_DESTRUCTOR_ITERATIONS |
| 430 | |
| 431 | #undef _POSIX_THREAD_KEYS_MAX |
| 432 | #define _POSIX_THREAD_KEYS_MAX PTHREAD_KEYS_MAX |
| 433 | |
| 434 | #undef PTHREAD_THREADS_MAX |
| 435 | #define PTHREAD_THREADS_MAX 2019 |
| 436 | |
| 437 | #undef _POSIX_SEM_NSEMS_MAX |
| 438 | #define _POSIX_SEM_NSEMS_MAX 256 |
| 439 | |
| 440 | #undef SEM_NSEMS_MAX |
| 441 | #define SEM_NSEMS_MAX 1024 |
| 442 | |
| 443 | /* Wrap cancellation points. */ |
| 444 | #if defined(__WINPTHREAD_ENABLE_WRAP_API) \ |
| 445 | || defined(__WINPTRHEAD_ENABLE_WRAP_API) /* historical typo */ |
| 446 | #define accept(...) (pthread_testcancel(), accept(__VA_ARGS__)) |
| 447 | #define aio_suspend(...) (pthread_testcancel(), aio_suspend(__VA_ARGS__)) |
| 448 | #define clock_nanosleep(...) (pthread_testcancel(), clock_nanosleep(__VA_ARGS__)) |
| 449 | #define close(...) (pthread_testcancel(), close(__VA_ARGS__)) |
| 450 | #define connect(...) (pthread_testcancel(), connect(__VA_ARGS__)) |
| 451 | #define creat(...) (pthread_testcancel(), creat(__VA_ARGS__)) |
| 452 | #define fcntl(...) (pthread_testcancel(), fcntl(__VA_ARGS__)) |
| 453 | #define fdatasync(...) (pthread_testcancel(), fdatasync(__VA_ARGS__)) |
| 454 | #define fsync(...) (pthread_testcancel(), fsync(__VA_ARGS__)) |
| 455 | #define getmsg(...) (pthread_testcancel(), getmsg(__VA_ARGS__)) |
| 456 | #define getpmsg(...) (pthread_testcancel(), getpmsg(__VA_ARGS__)) |
| 457 | #define lockf(...) (pthread_testcancel(), lockf(__VA_ARGS__)) |
| 458 | #define mg_receive(...) (pthread_testcancel(), mg_receive(__VA_ARGS__)) |
| 459 | #define mg_send(...) (pthread_testcancel(), mg_send(__VA_ARGS__)) |
| 460 | #define mg_timedreceive(...) (pthread_testcancel(), mg_timedreceive(__VA_ARGS__)) |
| 461 | #define mg_timessend(...) (pthread_testcancel(), mg_timedsend(__VA_ARGS__)) |
| 462 | #define msgrcv(...) (pthread_testcancel(), msgrecv(__VA_ARGS__)) |
| 463 | #define msgsnd(...) (pthread_testcancel(), msgsnd(__VA_ARGS__)) |
| 464 | #define msync(...) (pthread_testcancel(), msync(__VA_ARGS__)) |
| 465 | #define nanosleep(...) (pthread_testcancel(), nanosleep(__VA_ARGS__)) |
| 466 | #define open(...) (pthread_testcancel(), open(__VA_ARGS__)) |
| 467 | #define pause(...) (pthread_testcancel(), pause(__VA_ARGS__)) |
| 468 | #define poll(...) (pthread_testcancel(), poll(__VA_ARGS__)) |
| 469 | #define pread(...) (pthread_testcancel(), pread(__VA_ARGS__)) |
| 470 | #define pselect(...) (pthread_testcancel(), pselect(__VA_ARGS__)) |
| 471 | #define putmsg(...) (pthread_testcancel(), putmsg(__VA_ARGS__)) |
| 472 | #define putpmsg(...) (pthread_testcancel(), putpmsg(__VA_ARGS__)) |
| 473 | #define pwrite(...) (pthread_testcancel(), pwrite(__VA_ARGS__)) |
| 474 | #define read(...) (pthread_testcancel(), read(__VA_ARGS__)) |
| 475 | #define readv(...) (pthread_testcancel(), readv(__VA_ARGS__)) |
| 476 | #define recv(...) (pthread_testcancel(), recv(__VA_ARGS__)) |
| 477 | #define recvfrom(...) (pthread_testcancel(), recvfrom(__VA_ARGS__)) |
| 478 | #define recvmsg(...) (pthread_testcancel(), recvmsg(__VA_ARGS__)) |
| 479 | #define select(...) (pthread_testcancel(), select(__VA_ARGS__)) |
| 480 | #define sem_timedwait(...) (pthread_testcancel(), sem_timedwait(__VA_ARGS__)) |
| 481 | #define sem_wait(...) (pthread_testcancel(), sem_wait(__VA_ARGS__)) |
| 482 | #define send(...) (pthread_testcancel(), send(__VA_ARGS__)) |
| 483 | #define sendmsg(...) (pthread_testcancel(), sendmsg(__VA_ARGS__)) |
| 484 | #define sendto(...) (pthread_testcancel(), sendto(__VA_ARGS__)) |
| 485 | #define sigpause(...) (pthread_testcancel(), sigpause(__VA_ARGS__)) |
| 486 | #define sigsuspend(...) (pthread_testcancel(), sigsuspend(__VA_ARGS__)) |
| 487 | #define sigwait(...) (pthread_testcancel(), sigwait(__VA_ARGS__)) |
| 488 | #define sigwaitinfo(...) (pthread_testcancel(), sigwaitinfo(__VA_ARGS__)) |
| 489 | #define sleep(...) (pthread_testcancel(), sleep(__VA_ARGS__)) |
| 490 | //#define Sleep(...) (pthread_testcancel(), Sleep(__VA_ARGS__)) |
| 491 | #define system(...) (pthread_testcancel(), system(__VA_ARGS__)) |
| 492 | #define access(...) (pthread_testcancel(), access(__VA_ARGS__)) |
| 493 | #define asctime(...) (pthread_testcancel(), asctime(__VA_ARGS__)) |
| 494 | #define catclose(...) (pthread_testcancel(), catclose(__VA_ARGS__)) |
| 495 | #define catgets(...) (pthread_testcancel(), catgets(__VA_ARGS__)) |
| 496 | #define catopen(...) (pthread_testcancel(), catopen(__VA_ARGS__)) |
| 497 | #define closedir(...) (pthread_testcancel(), closedir(__VA_ARGS__)) |
| 498 | #define closelog(...) (pthread_testcancel(), closelog(__VA_ARGS__)) |
| 499 | #define ctermid(...) (pthread_testcancel(), ctermid(__VA_ARGS__)) |
| 500 | #define ctime(...) (pthread_testcancel(), ctime(__VA_ARGS__)) |
| 501 | #define dbm_close(...) (pthread_testcancel(), dbm_close(__VA_ARGS__)) |
| 502 | #define dbm_delete(...) (pthread_testcancel(), dbm_delete(__VA_ARGS__)) |
| 503 | #define dbm_fetch(...) (pthread_testcancel(), dbm_fetch(__VA_ARGS__)) |
| 504 | #define dbm_nextkey(...) (pthread_testcancel(), dbm_nextkey(__VA_ARGS__)) |
| 505 | #define dbm_open(...) (pthread_testcancel(), dbm_open(__VA_ARGS__)) |
| 506 | #define dbm_store(...) (pthread_testcancel(), dbm_store(__VA_ARGS__)) |
| 507 | #define dlclose(...) (pthread_testcancel(), dlclose(__VA_ARGS__)) |
| 508 | #define dlopen(...) (pthread_testcancel(), dlopen(__VA_ARGS__)) |
| 509 | #define endgrent(...) (pthread_testcancel(), endgrent(__VA_ARGS__)) |
| 510 | #define endhostent(...) (pthread_testcancel(), endhostent(__VA_ARGS__)) |
| 511 | #define endnetent(...) (pthread_testcancel(), endnetent(__VA_ARGS__)) |
| 512 | #define endprotoent(...) (pthread_testcancel(), endprotoend(__VA_ARGS__)) |
| 513 | #define endpwent(...) (pthread_testcancel(), endpwent(__VA_ARGS__)) |
| 514 | #define endservent(...) (pthread_testcancel(), endservent(__VA_ARGS__)) |
| 515 | #define endutxent(...) (pthread_testcancel(), endutxent(__VA_ARGS__)) |
| 516 | #define fclose(...) (pthread_testcancel(), fclose(__VA_ARGS__)) |
| 517 | #define fflush(...) (pthread_testcancel(), fflush(__VA_ARGS__)) |
| 518 | #define fgetc(...) (pthread_testcancel(), fgetc(__VA_ARGS__)) |
| 519 | #define fgetpos(...) (pthread_testcancel(), fgetpos(__VA_ARGS__)) |
| 520 | #define fgets(...) (pthread_testcancel(), fgets(__VA_ARGS__)) |
| 521 | #define fgetwc(...) (pthread_testcancel(), fgetwc(__VA_ARGS__)) |
| 522 | #define fgetws(...) (pthread_testcancel(), fgetws(__VA_ARGS__)) |
| 523 | #define fmtmsg(...) (pthread_testcancel(), fmtmsg(__VA_ARGS__)) |
| 524 | #define fopen(...) (pthread_testcancel(), fopen(__VA_ARGS__)) |
| 525 | #define fpathconf(...) (pthread_testcancel(), fpathconf(__VA_ARGS__)) |
| 526 | #define fprintf(...) (pthread_testcancel(), fprintf(__VA_ARGS__)) |
| 527 | #define fputc(...) (pthread_testcancel(), fputc(__VA_ARGS__)) |
| 528 | #define fputs(...) (pthread_testcancel(), fputs(__VA_ARGS__)) |
| 529 | #define fputwc(...) (pthread_testcancel(), fputwc(__VA_ARGS__)) |
| 530 | #define fputws(...) (pthread_testcancel(), fputws(__VA_ARGS__)) |
| 531 | #define fread(...) (pthread_testcancel(), fread(__VA_ARGS__)) |
| 532 | #define freopen(...) (pthread_testcancel(), freopen(__VA_ARGS__)) |
| 533 | #define fscanf(...) (pthread_testcancel(), fscanf(__VA_ARGS__)) |
| 534 | #define fseek(...) (pthread_testcancel(), fseek(__VA_ARGS__)) |
| 535 | #define fseeko(...) (pthread_testcancel(), fseeko(__VA_ARGS__)) |
| 536 | #define fsetpos(...) (pthread_testcancel(), fsetpos(__VA_ARGS__)) |
| 537 | #define fstat(...) (pthread_testcancel(), fstat(__VA_ARGS__)) |
| 538 | #define ftell(...) (pthread_testcancel(), ftell(__VA_ARGS__)) |
| 539 | #define ftello(...) (pthread_testcancel(), ftello(__VA_ARGS__)) |
| 540 | #define ftw(...) (pthread_testcancel(), ftw(__VA_ARGS__)) |
| 541 | #define fwprintf(...) (pthread_testcancel(), fwprintf(__VA_ARGS__)) |
| 542 | #define fwrite(...) (pthread_testcancel(), fwrite(__VA_ARGS__)) |
| 543 | #define fwscanf(...) (pthread_testcancel(), fwscanf(__VA_ARGS__)) |
| 544 | #define getaddrinfo(...) (pthread_testcancel(), getaddrinfo(__VA_ARGS__)) |
| 545 | #define getc(...) (pthread_testcancel(), getc(__VA_ARGS__)) |
| 546 | #define getc_unlocked(...) (pthread_testcancel(), getc_unlocked(__VA_ARGS__)) |
| 547 | #define getchar(...) (pthread_testcancel(), getchar(__VA_ARGS__)) |
| 548 | #define getchar_unlocked(...) (pthread_testcancel(), getchar_unlocked(__VA_ARGS__)) |
| 549 | #define getcwd(...) (pthread_testcancel(), getcwd(__VA_ARGS__)) |
| 550 | #define getdate(...) (pthread_testcancel(), getdate(__VA_ARGS__)) |
| 551 | #define getgrent(...) (pthread_testcancel(), getgrent(__VA_ARGS__)) |
| 552 | #define getgrgid(...) (pthread_testcancel(), getgrgid(__VA_ARGS__)) |
| 553 | #define getgrgid_r(...) (pthread_testcancel(), getgrgid_r(__VA_ARGS__)) |
| 554 | #define gergrnam(...) (pthread_testcancel(), getgrnam(__VA_ARGS__)) |
| 555 | #define getgrnam_r(...) (pthread_testcancel(), getgrnam_r(__VA_ARGS__)) |
| 556 | #define gethostbyaddr(...) (pthread_testcancel(), gethostbyaddr(__VA_ARGS__)) |
| 557 | #define gethostbyname(...) (pthread_testcancel(), gethostbyname(__VA_ARGS__)) |
| 558 | #define gethostent(...) (pthread_testcancel(), gethostent(__VA_ARGS__)) |
| 559 | #define gethostid(...) (pthread_testcancel(), gethostid(__VA_ARGS__)) |
| 560 | #define gethostname(...) (pthread_testcancel(), gethostname(__VA_ARGS__)) |
| 561 | #define getlogin(...) (pthread_testcancel(), getlogin(__VA_ARGS__)) |
| 562 | #define getlogin_r(...) (pthread_testcancel(), getlogin_r(__VA_ARGS__)) |
| 563 | #define getnameinfo(...) (pthread_testcancel(), getnameinfo(__VA_ARGS__)) |
| 564 | #define getnetbyaddr(...) (pthread_testcancel(), getnetbyaddr(__VA_ARGS__)) |
| 565 | #define getnetbyname(...) (pthread_testcancel(), getnetbyname(__VA_ARGS__)) |
| 566 | #define getnetent(...) (pthread_testcancel(), getnetent(__VA_ARGS__)) |
| 567 | #define getopt(...) (pthread_testcancel(), getopt(__VA_ARGS__)) |
| 568 | #define getprotobyname(...) (pthread_testcancel(), getprotobyname(__VA_ARGS__)) |
| 569 | #define getprotobynumber(...) (pthread_testcancel(), getprotobynumber(__VA_ARGS__)) |
| 570 | #define getprotoent(...) (pthread_testcancel(), getprotoent(__VA_ARGS__)) |
| 571 | #define getpwent(...) (pthread_testcancel(), getpwent(__VA_ARGS__)) |
| 572 | #define getpwnam(...) (pthread_testcancel(), getpwnam(__VA_ARGS__)) |
| 573 | #define getpwnam_r(...) (pthread_testcancel(), getpwnam_r(__VA_ARGS__)) |
| 574 | #define getpwuid(...) (pthread_testcancel(), getpwuid(__VA_ARGS__)) |
| 575 | #define getpwuid_r(...) (pthread_testcancel(), getpwuid_r(__VA_ARGS__)) |
| 576 | #define gets(...) (pthread_testcancel(), gets(__VA_ARGS__)) |
| 577 | #define getservbyname(...) (pthread_testcancel(), getservbyname(__VA_ARGS__)) |
| 578 | #define getservbyport(...) (pthread_testcancel(), getservbyport(__VA_ARGS__)) |
| 579 | #define getservent(...) (pthread_testcancel(), getservent(__VA_ARGS__)) |
| 580 | #define getutxent(...) (pthread_testcancel(), getutxent(__VA_ARGS__)) |
| 581 | #define getutxid(...) (pthread_testcancel(), getutxid(__VA_ARGS__)) |
| 582 | #define getutxline(...) (pthread_testcancel(), getutxline(__VA_ARGS__)) |
| 583 | #undef getwc |
| 584 | #define getwc(...) (pthread_testcancel(), getwc(__VA_ARGS__)) |
| 585 | #undef getwchar |
| 586 | #define getwchar(...) (pthread_testcancel(), getwchar(__VA_ARGS__)) |
| 587 | #define getwd(...) (pthread_testcancel(), getwd(__VA_ARGS__)) |
| 588 | #define glob(...) (pthread_testcancel(), glob(__VA_ARGS__)) |
| 589 | #define iconv_close(...) (pthread_testcancel(), iconv_close(__VA_ARGS__)) |
| 590 | #define iconv_open(...) (pthread_testcancel(), iconv_open(__VA_ARGS__)) |
| 591 | #define ioctl(...) (pthread_testcancel(), ioctl(__VA_ARGS__)) |
| 592 | #define link(...) (pthread_testcancel(), link(__VA_ARGS__)) |
| 593 | #define localtime(...) (pthread_testcancel(), localtime(__VA_ARGS__)) |
| 594 | #define lseek(...) (pthread_testcancel(), lseek(__VA_ARGS__)) |
| 595 | #define lstat(...) (pthread_testcancel(), lstat(__VA_ARGS__)) |
| 596 | #define mkstemp(...) (pthread_testcancel(), mkstemp(__VA_ARGS__)) |
| 597 | #define nftw(...) (pthread_testcancel(), nftw(__VA_ARGS__)) |
| 598 | #define opendir(...) (pthread_testcancel(), opendir(__VA_ARGS__)) |
| 599 | #define openlog(...) (pthread_testcancel(), openlog(__VA_ARGS__)) |
| 600 | #define pathconf(...) (pthread_testcancel(), pathconf(__VA_ARGS__)) |
| 601 | #define pclose(...) (pthread_testcancel(), pclose(__VA_ARGS__)) |
| 602 | #define perror(...) (pthread_testcancel(), perror(__VA_ARGS__)) |
| 603 | #define popen(...) (pthread_testcancel(), popen(__VA_ARGS__)) |
| 604 | #define posix_fadvise(...) (pthread_testcancel(), posix_fadvise(__VA_ARGS__)) |
| 605 | #define posix_fallocate(...) (pthread_testcancel(), posix_fallocate(__VA_ARGS__)) |
| 606 | #define posix_madvise(...) (pthread_testcancel(), posix_madvise(__VA_ARGS__)) |
| 607 | #define posix_openpt(...) (pthread_testcancel(), posix_openpt(__VA_ARGS__)) |
| 608 | #define posix_spawn(...) (pthread_testcancel(), posix_spawn(__VA_ARGS__)) |
| 609 | #define posix_spawnp(...) (pthread_testcancel(), posix_spawnp(__VA_ARGS__)) |
| 610 | #define posix_trace_clear(...) (pthread_testcancel(), posix_trace_clear(__VA_ARGS__)) |
| 611 | #define posix_trace_close(...) (pthread_testcancel(), posix_trace_close(__VA_ARGS__)) |
| 612 | #define posix_trace_create(...) (pthread_testcancel(), posix_trace_create(__VA_ARGS__)) |
| 613 | #define posix_trace_create_withlog(...) (pthread_testcancel(), posix_trace_create_withlog(__VA_ARGS__)) |
| 614 | #define posix_trace_eventtypelist_getne(...) (pthread_testcancel(), posix_trace_eventtypelist_getne(__VA_ARGS__)) |
| 615 | #define posix_trace_eventtypelist_rewin(...) (pthread_testcancel(), posix_trace_eventtypelist_rewin(__VA_ARGS__)) |
| 616 | #define posix_trace_flush(...) (pthread_testcancel(), posix_trace_flush(__VA_ARGS__)) |
| 617 | #define posix_trace_get_attr(...) (pthread_testcancel(), posix_trace_get_attr(__VA_ARGS__)) |
| 618 | #define posix_trace_get_filter(...) (pthread_testcancel(), posix_trace_get_filter(__VA_ARGS__)) |
| 619 | #define posix_trace_get_status(...) (pthread_testcancel(), posix_trace_get_status(__VA_ARGS__)) |
| 620 | #define posix_trace_getnext_event(...) (pthread_testcancel(), posix_trace_getnext_event(__VA_ARGS__)) |
| 621 | #define posix_trace_open(...) (pthread_testcancel(), posix_trace_open(__VA_ARGS__)) |
| 622 | #define posix_trace_rewind(...) (pthread_testcancel(), posix_trace_rewind(__VA_ARGS__)) |
| 623 | #define posix_trace_setfilter(...) (pthread_testcancel(), posix_trace_setfilter(__VA_ARGS__)) |
| 624 | #define posix_trace_shutdown(...) (pthread_testcancel(), posix_trace_shutdown(__VA_ARGS__)) |
| 625 | #define posix_trace_timedgetnext_event(...) (pthread_testcancel(), posix_trace_timedgetnext_event(__VA_ARGS__)) |
| 626 | #define posix_typed_mem_open(...) (pthread_testcancel(), posix_typed_mem_open(__VA_ARGS__)) |
| 627 | #define printf(...) (pthread_testcancel(), printf(__VA_ARGS__)) |
| 628 | #define putc(...) (pthread_testcancel(), putc(__VA_ARGS__)) |
| 629 | #define putc_unlocked(...) (pthread_testcancel(), putc_unlocked(__VA_ARGS__)) |
| 630 | #define putchar(...) (pthread_testcancel(), putchar(__VA_ARGS__)) |
| 631 | #define putchar_unlocked(...) (pthread_testcancel(), putchar_unlocked(__VA_ARGS__)) |
| 632 | #define puts(...) (pthread_testcancel(), puts(__VA_ARGS__)) |
| 633 | #define pututxline(...) (pthread_testcancel(), pututxline(__VA_ARGS__)) |
| 634 | #undef putwc |
| 635 | #define putwc(...) (pthread_testcancel(), putwc(__VA_ARGS__)) |
| 636 | #undef putwchar |
| 637 | #define putwchar(...) (pthread_testcancel(), putwchar(__VA_ARGS__)) |
| 638 | #define readdir(...) (pthread_testcancel(), readdir(__VA_ARSG__)) |
| 639 | #define readdir_r(...) (pthread_testcancel(), readdir_r(__VA_ARGS__)) |
| 640 | #define remove(...) (pthread_testcancel(), remove(__VA_ARGS__)) |
| 641 | #define rename(...) (pthread_testcancel(), rename(__VA_ARGS__)) |
| 642 | #define rewind(...) (pthread_testcancel(), rewind(__VA_ARGS__)) |
| 643 | #define rewinddir(...) (pthread_testcancel(), rewinddir(__VA_ARGS__)) |
| 644 | #define scanf(...) (pthread_testcancel(), scanf(__VA_ARGS__)) |
| 645 | #define seekdir(...) (pthread_testcancel(), seekdir(__VA_ARGS__)) |
| 646 | #define semop(...) (pthread_testcancel(), semop(__VA_ARGS__)) |
| 647 | #define setgrent(...) (pthread_testcancel(), setgrent(__VA_ARGS__)) |
| 648 | #define sethostent(...) (pthread_testcancel(), sethostemt(__VA_ARGS__)) |
| 649 | #define setnetent(...) (pthread_testcancel(), setnetent(__VA_ARGS__)) |
| 650 | #define setprotoent(...) (pthread_testcancel(), setprotoent(__VA_ARGS__)) |
| 651 | #define setpwent(...) (pthread_testcancel(), setpwent(__VA_ARGS__)) |
| 652 | #define setservent(...) (pthread_testcancel(), setservent(__VA_ARGS__)) |
| 653 | #define setutxent(...) (pthread_testcancel(), setutxent(__VA_ARGS__)) |
| 654 | #define stat(...) (pthread_testcancel(), stat(__VA_ARGS__)) |
| 655 | #define strerror(...) (pthread_testcancel(), strerror(__VA_ARGS__)) |
| 656 | #define strerror_r(...) (pthread_testcancel(), strerror_r(__VA_ARGS__)) |
| 657 | #define strftime(...) (pthread_testcancel(), strftime(__VA_ARGS__)) |
| 658 | #define symlink(...) (pthread_testcancel(), symlink(__VA_ARGS__)) |
| 659 | #define sync(...) (pthread_testcancel(), sync(__VA_ARGS__)) |
| 660 | #define syslog(...) (pthread_testcancel(), syslog(__VA_ARGS__)) |
| 661 | #define tmpfile(...) (pthread_testcancel(), tmpfile(__VA_ARGS__)) |
| 662 | #define tmpnam(...) (pthread_testcancel(), tmpnam(__VA_ARGS__)) |
| 663 | #define ttyname(...) (pthread_testcancel(), ttyname(__VA_ARGS__)) |
| 664 | #define ttyname_r(...) (pthread_testcancel(), ttyname_r(__VA_ARGS__)) |
| 665 | #define tzset(...) (pthread_testcancel(), tzset(__VA_ARGS__)) |
| 666 | #define ungetc(...) (pthread_testcancel(), ungetc(__VA_ARGS__)) |
| 667 | #define ungetwc(...) (pthread_testcancel(), ungetwc(__VA_ARGS__)) |
| 668 | #define unlink(...) (pthread_testcancel(), unlink(__VA_ARGS__)) |
| 669 | #define vfprintf(...) (pthread_testcancel(), vfprintf(__VA_ARGS__)) |
| 670 | #define vfwprintf(...) (pthread_testcancel(), vfwprintf(__VA_ARGS__)) |
| 671 | #define vprintf(...) (pthread_testcancel(), vprintf(__VA_ARGS__)) |
| 672 | #define vwprintf(...) (pthread_testcancel(), vwprintf(__VA_ARGS__)) |
| 673 | #define wcsftime(...) (pthread_testcancel(), wcsftime(__VA_ARGS__)) |
| 674 | #define wordexp(...) (pthread_testcancel(), wordexp(__VA_ARGS__)) |
| 675 | #define wprintf(...) (pthread_testcancel(), wprintf(__VA_ARGS__)) |
| 676 | #define wscanf(...) (pthread_testcancel(), wscanf(__VA_ARGS__)) |
| 677 | #endif |
| 678 | |
| 679 | /* We deal here with a gcc issue for posix threading on Windows. |
| 680 | We would need to change here gcc's gthr-posix.h header, but this |
| 681 | got rejected. So we deal it within this header. */ |
| 682 | #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC |
| 683 | #undef _GTHREAD_USE_MUTEX_INIT_FUNC |
| 684 | #endif |
| 685 | #define _GTHREAD_USE_MUTEX_INIT_FUNC 1 |
| 686 | |
| 687 | #ifdef __cplusplus |
| 688 | } |
| 689 | #endif |
| 690 | |
| 691 | #endif /* WIN_PTHREADS_H */ |