Home | History | Annotate | Download | only in include
      1 /*
      2    Copyright (c) 2011-2013 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 
     70 #include <sys/timeb.h>
     71 
     72 #include "pthread_compat.h"
     73 
     74 #ifdef __cplusplus
     75 extern "C" {
     76 #endif
     77 
     78 #define __WINPTHREADS_VERSION_MAJOR 0
     79 #define __WINPTHREADS_VERSION_MINOR 5
     80 #define __WINPTHREADS_VERSION_PATCHLEVEL 0
     81 
     82 /* MSB 8-bit major version, 8-bit minor version, 16-bit patch level.  */
     83 #define __WINPTHREADS_VERSION 0x00050000
     84 
     85 #if defined DLL_EXPORT
     86 #ifdef IN_WINPTHREAD
     87 #define WINPTHREAD_API __declspec(dllexport)
     88 #else
     89 #define WINPTHREAD_API __declspec(dllimport)
     90 #endif
     91 #else
     92 #define WINPTHREAD_API
     93 #endif
     94 
     95 /* #define WINPTHREAD_DBG 1 */
     96 
     97 /* Compatibility stuff: */
     98 #define RWLS_PER_THREAD						8
     99 
    100 /* Error-codes.  */
    101 #ifndef ETIMEDOUT
    102 #define ETIMEDOUT	138
    103 #endif
    104 #ifndef ENOTSUP
    105 #define ENOTSUP		129
    106 #endif
    107 #ifndef EWOULDBLOCK
    108 #define EWOULDBLOCK	140
    109 #endif
    110 
    111 /* pthread specific defines.  */
    112 
    113 #define PTHREAD_CANCEL_DISABLE 0
    114 #define PTHREAD_CANCEL_ENABLE 0x01
    115 
    116 #define PTHREAD_CANCEL_DEFERRED 0
    117 #define PTHREAD_CANCEL_ASYNCHRONOUS 0x02
    118 
    119 #define PTHREAD_CREATE_JOINABLE 0
    120 #define PTHREAD_CREATE_DETACHED 0x04
    121 
    122 #define PTHREAD_EXPLICIT_SCHED 0
    123 #define PTHREAD_INHERIT_SCHED 0x08
    124 
    125 #define PTHREAD_SCOPE_PROCESS 0
    126 #define PTHREAD_SCOPE_SYSTEM 0x10
    127 
    128 #define PTHREAD_DEFAULT_ATTR (PTHREAD_CANCEL_ENABLE)
    129 
    130 #define PTHREAD_CANCELED ((void *) (intptr_t) 0xDEADBEEF)
    131 
    132 #define _PTHREAD_NULL_THREAD ((pthread_t) 0)
    133 
    134 #define PTHREAD_ONCE_INIT 0
    135 
    136 #define PTHREAD_DESTRUCTOR_ITERATIONS 256
    137 #define PTHREAD_KEYS_MAX (1<<20)
    138 
    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
    143 
    144 #define PTHREAD_MUTEX_SHARED 1
    145 #define PTHREAD_MUTEX_PRIVATE 0
    146 
    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
    153 
    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
    159 
    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);
    164 
    165 #define PTHREAD_BARRIER_SERIAL_THREAD 1
    166 
    167 /* maximum number of times a read lock may be obtained */
    168 #define	MAX_READ_LOCKS		(INT_MAX - 1)
    169 
    170 /* No fork() in windows - so ignore this */
    171 #define pthread_atfork(F1,F2,F3) 0
    172 
    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 
    180 typedef long pthread_once_t;
    181 typedef unsigned pthread_mutexattr_t;
    182 typedef unsigned pthread_key_t;
    183 typedef void *pthread_barrierattr_t;
    184 typedef int pthread_condattr_t;
    185 typedef int pthread_rwlockattr_t;
    186 
    187 /*
    188 struct _pthread_v;
    189 
    190 typedef struct pthread_t {
    191   struct _pthread_v *p;
    192   int x;
    193 } pthread_t;
    194 */
    195 
    196 typedef uintptr_t pthread_t;
    197 
    198 typedef struct _pthread_cleanup _pthread_cleanup;
    199 struct _pthread_cleanup
    200 {
    201     void (*func)(void *);
    202     void *arg;
    203     _pthread_cleanup *next;
    204 };
    205 
    206 #define pthread_cleanup_push(F, A)\
    207 {\
    208     const _pthread_cleanup _pthread_cup = {(F), (A), *pthread_getclean()};\
    209     __sync_synchronize();\
    210     *pthread_getclean() = (_pthread_cleanup *) &_pthread_cup;\
    211     __sync_synchronize()
    212 
    213 /* Note that if async cancelling is used, then there is a race here */
    214 #define pthread_cleanup_pop(E)\
    215     (*pthread_getclean() = _pthread_cup.next, ((E) ? (_pthread_cup.func((pthread_once_t *)_pthread_cup.arg)) : (void)0));}
    216 
    217 /* Windows doesn't have this, so declare it ourselves. */
    218 #ifndef _TIMESPEC_DEFINED
    219 #define _TIMESPEC_DEFINED
    220 struct timespec {
    221   time_t  tv_sec;   /* Seconds */
    222   long    tv_nsec;  /* Nanoseconds */
    223 };
    224 
    225 struct itimerspec {
    226   struct timespec  it_interval;  /* Timer period */
    227   struct timespec  it_value;     /* Timer expiration */
    228 };
    229 #endif
    230 
    231 #ifndef SCHED_OTHER
    232 /* Some POSIX realtime extensions, mostly stubbed */
    233 #define SCHED_OTHER     0
    234 #define SCHED_FIFO      1
    235 #define SCHED_RR        2
    236 #define SCHED_MIN       SCHED_OTHER
    237 #define SCHED_MAX       SCHED_RR
    238 
    239 struct sched_param {
    240   int sched_priority;
    241 };
    242 
    243 int WINPTHREAD_API sched_yield(void);
    244 int WINPTHREAD_API sched_get_priority_min(int pol);
    245 int WINPTHREAD_API sched_get_priority_max(int pol);
    246 int WINPTHREAD_API sched_getscheduler(pid_t pid);
    247 int WINPTHREAD_API sched_setscheduler(pid_t pid, int pol, const struct sched_param *param);
    248 
    249 #endif
    250 
    251 typedef struct pthread_attr_t pthread_attr_t;
    252 struct pthread_attr_t
    253 {
    254     unsigned p_state;
    255     void *stack;
    256     size_t s_size;
    257     struct sched_param param;
    258 };
    259 
    260 int WINPTHREAD_API pthread_attr_setschedparam(pthread_attr_t *attr, const struct sched_param *param);
    261 int WINPTHREAD_API pthread_attr_getschedparam(const pthread_attr_t *attr, struct sched_param *param);
    262 int WINPTHREAD_API pthread_getschedparam(pthread_t thread, int *pol, struct sched_param *param);
    263 int WINPTHREAD_API pthread_setschedparam(pthread_t thread, int pol, const struct sched_param *param);
    264 int WINPTHREAD_API pthread_attr_setschedpolicy (pthread_attr_t *attr, int pol);
    265 int WINPTHREAD_API pthread_attr_getschedpolicy (pthread_attr_t *attr, int *pol);
    266 
    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;
    273 
    274 #define PTHREAD_MUTEX_NORMAL 0
    275 #define PTHREAD_MUTEX_ERRORCHECK 1
    276 #define PTHREAD_MUTEX_RECURSIVE 2
    277 
    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
    290 
    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);
    296 
    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 int       WINPTHREAD_API pthread_get_concurrency(int *val);
    304 int       WINPTHREAD_API pthread_set_concurrency(int val);
    305 void      WINPTHREAD_API pthread_exit(void *res);
    306 void      WINPTHREAD_API _pthread_invoke_cancel(void);
    307 int       WINPTHREAD_API pthread_cancel(pthread_t t);
    308 int       WINPTHREAD_API pthread_kill(pthread_t t, int sig);
    309 unsigned  WINPTHREAD_API _pthread_get_state(const pthread_attr_t *attr, unsigned flag);
    310 int       WINPTHREAD_API _pthread_set_state(pthread_attr_t *attr, unsigned flag, unsigned val);
    311 int       WINPTHREAD_API pthread_setcancelstate(int state, int *oldstate);
    312 int       WINPTHREAD_API pthread_setcanceltype(int type, int *oldtype);
    313 int       WINPTHREAD_API pthread_create_wrapper(void *args);
    314 int       WINPTHREAD_API pthread_create(pthread_t *th, const pthread_attr_t *attr, void *(* func)(void *), void *arg);
    315 int       WINPTHREAD_API pthread_join(pthread_t t, void **res);
    316 int       WINPTHREAD_API pthread_detach(pthread_t t);
    317 int       WINPTHREAD_API pthread_setname_np(pthread_t thread, const char *name);
    318 int       WINPTHREAD_API pthread_getname_np(pthread_t thread, char *name, size_t len);
    319 
    320 
    321 int WINPTHREAD_API pthread_rwlock_init(pthread_rwlock_t *rwlock_, const pthread_rwlockattr_t *attr);
    322 int WINPTHREAD_API pthread_rwlock_wrlock(pthread_rwlock_t *l);
    323 int WINPTHREAD_API pthread_rwlock_timedwrlock(pthread_rwlock_t *rwlock, const struct timespec *ts);
    324 int WINPTHREAD_API pthread_rwlock_rdlock(pthread_rwlock_t *l);
    325 int WINPTHREAD_API pthread_rwlock_timedrdlock(pthread_rwlock_t *l, const struct timespec *ts);
    326 int WINPTHREAD_API pthread_rwlock_unlock(pthread_rwlock_t *l);
    327 int WINPTHREAD_API pthread_rwlock_tryrdlock(pthread_rwlock_t *l);
    328 int WINPTHREAD_API pthread_rwlock_trywrlock(pthread_rwlock_t *l);
    329 int WINPTHREAD_API pthread_rwlock_destroy (pthread_rwlock_t *l);
    330 
    331 int WINPTHREAD_API pthread_cond_init(pthread_cond_t *cv, const pthread_condattr_t *a);
    332 int WINPTHREAD_API pthread_cond_destroy(pthread_cond_t *cv);
    333 int WINPTHREAD_API pthread_cond_signal (pthread_cond_t *cv);
    334 int WINPTHREAD_API pthread_cond_broadcast (pthread_cond_t *cv);
    335 int WINPTHREAD_API pthread_cond_wait (pthread_cond_t *cv, pthread_mutex_t *external_mutex);
    336 int WINPTHREAD_API pthread_cond_timedwait(pthread_cond_t *cv, pthread_mutex_t *external_mutex, const struct timespec *t);
    337 int WINPTHREAD_API pthread_cond_timedwait_relative_np(pthread_cond_t *cv, pthread_mutex_t *external_mutex, const struct timespec *t);
    338 
    339 int WINPTHREAD_API pthread_mutex_lock(pthread_mutex_t *m);
    340 int WINPTHREAD_API pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec *ts);
    341 int WINPTHREAD_API pthread_mutex_unlock(pthread_mutex_t *m);
    342 int WINPTHREAD_API pthread_mutex_trylock(pthread_mutex_t *m);
    343 int WINPTHREAD_API pthread_mutex_init(pthread_mutex_t *m, const pthread_mutexattr_t *a);
    344 int WINPTHREAD_API pthread_mutex_destroy(pthread_mutex_t *m);
    345 
    346 int WINPTHREAD_API pthread_barrier_destroy(pthread_barrier_t *b);
    347 int WINPTHREAD_API pthread_barrier_init(pthread_barrier_t *b, const void *attr, unsigned int count);
    348 int WINPTHREAD_API pthread_barrier_wait(pthread_barrier_t *b);
    349 
    350 int WINPTHREAD_API pthread_spin_init(pthread_spinlock_t *l, int pshared);
    351 int WINPTHREAD_API pthread_spin_destroy(pthread_spinlock_t *l);
    352 /* No-fair spinlock due to lack of knowledge of thread number.  */
    353 int WINPTHREAD_API pthread_spin_lock(pthread_spinlock_t *l);
    354 int WINPTHREAD_API pthread_spin_trylock(pthread_spinlock_t *l);
    355 int WINPTHREAD_API pthread_spin_unlock(pthread_spinlock_t *l);
    356 
    357 int WINPTHREAD_API pthread_attr_init(pthread_attr_t *attr);
    358 int WINPTHREAD_API pthread_attr_destroy(pthread_attr_t *attr);
    359 int WINPTHREAD_API pthread_attr_setdetachstate(pthread_attr_t *a, int flag);
    360 int WINPTHREAD_API pthread_attr_getdetachstate(const pthread_attr_t *a, int *flag);
    361 int WINPTHREAD_API pthread_attr_setinheritsched(pthread_attr_t *a, int flag);
    362 int WINPTHREAD_API pthread_attr_getinheritsched(const pthread_attr_t *a, int *flag);
    363 int WINPTHREAD_API pthread_attr_setscope(pthread_attr_t *a, int flag);
    364 int WINPTHREAD_API pthread_attr_getscope(const pthread_attr_t *a, int *flag);
    365 int WINPTHREAD_API pthread_attr_getstackaddr(pthread_attr_t *attr, void **stack);
    366 int WINPTHREAD_API pthread_attr_setstackaddr(pthread_attr_t *attr, void *stack);
    367 int WINPTHREAD_API pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *size);
    368 int WINPTHREAD_API pthread_attr_setstacksize(pthread_attr_t *attr, size_t size);
    369 
    370 int WINPTHREAD_API pthread_mutexattr_init(pthread_mutexattr_t *a);
    371 int WINPTHREAD_API pthread_mutexattr_destroy(pthread_mutexattr_t *a);
    372 int WINPTHREAD_API pthread_mutexattr_gettype(const pthread_mutexattr_t *a, int *type);
    373 int WINPTHREAD_API pthread_mutexattr_settype(pthread_mutexattr_t *a, int type);
    374 int WINPTHREAD_API pthread_mutexattr_getpshared(const pthread_mutexattr_t *a, int *type);
    375 int WINPTHREAD_API pthread_mutexattr_setpshared(pthread_mutexattr_t * a, int type);
    376 int WINPTHREAD_API pthread_mutexattr_getprotocol(const pthread_mutexattr_t *a, int *type);
    377 int WINPTHREAD_API pthread_mutexattr_setprotocol(pthread_mutexattr_t *a, int type);
    378 int WINPTHREAD_API pthread_mutexattr_getprioceiling(const pthread_mutexattr_t *a, int * prio);
    379 int WINPTHREAD_API pthread_mutexattr_setprioceiling(pthread_mutexattr_t *a, int prio);
    380 int WINPTHREAD_API pthread_getconcurrency(void);
    381 int WINPTHREAD_API pthread_setconcurrency(int new_level);
    382 
    383 int WINPTHREAD_API pthread_condattr_destroy(pthread_condattr_t *a);
    384 int WINPTHREAD_API pthread_condattr_init(pthread_condattr_t *a);
    385 int WINPTHREAD_API pthread_condattr_getpshared(const pthread_condattr_t *a, int *s);
    386 int WINPTHREAD_API pthread_condattr_setpshared(pthread_condattr_t *a, int s);
    387 
    388 #ifndef __clockid_t_defined
    389 typedef int clockid_t;
    390 #define __clockid_t_defined 1
    391 #endif  /* __clockid_t_defined */
    392 
    393 int WINPTHREAD_API pthread_condattr_getclock (const pthread_condattr_t *attr,
    394        clockid_t *clock_id);
    395 int WINPTHREAD_API pthread_condattr_setclock(pthread_condattr_t *attr,
    396        clockid_t clock_id);
    397 int WINPTHREAD_API __pthread_clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp, struct timespec *rmtp);
    398 
    399 int WINPTHREAD_API pthread_barrierattr_init(void **attr);
    400 int WINPTHREAD_API pthread_barrierattr_destroy(void **attr);
    401 int WINPTHREAD_API pthread_barrierattr_setpshared(void **attr, int s);
    402 int WINPTHREAD_API pthread_barrierattr_getpshared(void **attr, int *s);
    403 
    404 /* Private extensions for analysis and internal use.  */
    405 struct _pthread_cleanup ** WINPTHREAD_API pthread_getclean (void);
    406 void *                     WINPTHREAD_API pthread_gethandle (pthread_t t);
    407 void *                     WINPTHREAD_API pthread_getevent ();
    408 
    409 unsigned long long         WINPTHREAD_API _pthread_rel_time_in_ms(const struct timespec *ts);
    410 unsigned long long         WINPTHREAD_API _pthread_time_in_ms(void);
    411 unsigned long long         WINPTHREAD_API _pthread_time_in_ms_from_timespec(const struct timespec *ts);
    412 int                        WINPTHREAD_API _pthread_tryjoin (pthread_t t, void **res);
    413 int                        WINPTHREAD_API pthread_rwlockattr_destroy(pthread_rwlockattr_t *a);
    414 int                        WINPTHREAD_API pthread_rwlockattr_getpshared(pthread_rwlockattr_t *a, int *s);
    415 int                        WINPTHREAD_API pthread_rwlockattr_init(pthread_rwlockattr_t *a);
    416 int                        WINPTHREAD_API pthread_rwlockattr_setpshared(pthread_rwlockattr_t *a, int s);
    417 
    418 #ifndef SIG_BLOCK
    419 #define SIG_BLOCK 0
    420 #endif
    421 #ifndef SIG_UNBLOCK
    422 #define SIG_UNBLOCK 1
    423 #endif
    424 #ifndef SIG_SETMASK
    425 #define SIG_SETMASK 2
    426 #endif
    427 
    428 #include <pthread_unistd.h>
    429 
    430 #undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
    431 #define _POSIX_THREAD_DESTRUCTOR_ITERATIONS     PTHREAD_DESTRUCTOR_ITERATIONS
    432 
    433 #undef _POSIX_THREAD_KEYS_MAX
    434 #define _POSIX_THREAD_KEYS_MAX                  PTHREAD_KEYS_MAX
    435 
    436 #undef PTHREAD_THREADS_MAX
    437 #define PTHREAD_THREADS_MAX                     2019
    438 
    439 #undef _POSIX_SEM_NSEMS_MAX
    440 #define _POSIX_SEM_NSEMS_MAX                    256
    441 
    442 #undef SEM_NSEMS_MAX
    443 #define SEM_NSEMS_MAX                           1024
    444 
    445 /* Wrap cancellation points.  */
    446 #ifdef __WINPTRHEAD_ENABLE_WRAP_API
    447 #define accept(...) (pthread_testcancel(), accept(__VA_ARGS__))
    448 #define aio_suspend(...) (pthread_testcancel(), aio_suspend(__VA_ARGS__))
    449 #define clock_nanosleep(...) (pthread_testcancel(), clock_nanosleep(__VA_ARGS__))
    450 #define close(...) (pthread_testcancel(), close(__VA_ARGS__))
    451 #define connect(...) (pthread_testcancel(), connect(__VA_ARGS__))
    452 #define creat(...) (pthread_testcancel(), creat(__VA_ARGS__))
    453 #define fcntl(...) (pthread_testcancel(), fcntl(__VA_ARGS__))
    454 #define fdatasync(...) (pthread_testcancel(), fdatasync(__VA_ARGS__))
    455 #define fsync(...) (pthread_testcancel(), fsync(__VA_ARGS__))
    456 #define getmsg(...) (pthread_testcancel(), getmsg(__VA_ARGS__))
    457 #define getpmsg(...) (pthread_testcancel(), getpmsg(__VA_ARGS__))
    458 #define lockf(...) (pthread_testcancel(), lockf(__VA_ARGS__))
    459 #define mg_receive(...) (pthread_testcancel(), mg_receive(__VA_ARGS__))
    460 #define mg_send(...) (pthread_testcancel(), mg_send(__VA_ARGS__))
    461 #define mg_timedreceive(...) (pthread_testcancel(), mg_timedreceive(__VA_ARGS__))
    462 #define mg_timessend(...) (pthread_testcancel(), mg_timedsend(__VA_ARGS__))
    463 #define msgrcv(...) (pthread_testcancel(), msgrecv(__VA_ARGS__))
    464 #define msgsnd(...) (pthread_testcancel(), msgsnd(__VA_ARGS__))
    465 #define msync(...) (pthread_testcancel(), msync(__VA_ARGS__))
    466 #define nanosleep(...) (pthread_testcancel(), nanosleep(__VA_ARGS__))
    467 #define open(...) (pthread_testcancel(), open(__VA_ARGS__))
    468 #define pause(...) (pthread_testcancel(), pause(__VA_ARGS__))
    469 #define poll(...) (pthread_testcancel(), poll(__VA_ARGS__))
    470 #define pread(...) (pthread_testcancel(), pread(__VA_ARGS__))
    471 #define pselect(...) (pthread_testcancel(), pselect(__VA_ARGS__))
    472 #define putmsg(...) (pthread_testcancel(), putmsg(__VA_ARGS__))
    473 #define putpmsg(...) (pthread_testcancel(), putpmsg(__VA_ARGS__))
    474 #define pwrite(...) (pthread_testcancel(), pwrite(__VA_ARGS__))
    475 #define read(...) (pthread_testcancel(), read(__VA_ARGS__))
    476 #define readv(...) (pthread_testcancel(), readv(__VA_ARGS__))
    477 #define recv(...) (pthread_testcancel(), recv(__VA_ARGS__))
    478 #define recvfrom(...) (pthread_testcancel(), recvfrom(__VA_ARGS__))
    479 #define recvmsg(...) (pthread_testcancel(), recvmsg(__VA_ARGS__))
    480 #define select(...) (pthread_testcancel(), select(__VA_ARGS__))
    481 #define sem_timedwait(...) (pthread_testcancel(), sem_timedwait(__VA_ARGS__))
    482 #define sem_wait(...) (pthread_testcancel(), sem_wait(__VA_ARGS__))
    483 #define send(...) (pthread_testcancel(), send(__VA_ARGS__))
    484 #define sendmsg(...) (pthread_testcancel(), sendmsg(__VA_ARGS__))
    485 #define sendto(...) (pthread_testcancel(), sendto(__VA_ARGS__))
    486 #define sigpause(...) (pthread_testcancel(), sigpause(__VA_ARGS__))
    487 #define sigsuspend(...) (pthread_testcancel(), sigsuspend(__VA_ARGS__))
    488 #define sigwait(...) (pthread_testcancel(), sigwait(__VA_ARGS__))
    489 #define sigwaitinfo(...) (pthread_testcancel(), sigwaitinfo(__VA_ARGS__))
    490 #define sleep(...) (pthread_testcancel(), sleep(__VA_ARGS__))
    491 //#define Sleep(...) (pthread_testcancel(), Sleep(__VA_ARGS__))
    492 #define system(...) (pthread_testcancel(), system(__VA_ARGS__))
    493 #define access(...) (pthread_testcancel(), access(__VA_ARGS__))
    494 #define asctime(...) (pthread_testcancel(), asctime(__VA_ARGS__))
    495 #define catclose(...) (pthread_testcancel(), catclose(__VA_ARGS__))
    496 #define catgets(...) (pthread_testcancel(), catgets(__VA_ARGS__))
    497 #define catopen(...) (pthread_testcancel(), catopen(__VA_ARGS__))
    498 #define closedir(...) (pthread_testcancel(), closedir(__VA_ARGS__))
    499 #define closelog(...) (pthread_testcancel(), closelog(__VA_ARGS__))
    500 #define ctermid(...) (pthread_testcancel(), ctermid(__VA_ARGS__))
    501 #define ctime(...) (pthread_testcancel(), ctime(__VA_ARGS__))
    502 #define dbm_close(...) (pthread_testcancel(), dbm_close(__VA_ARGS__))
    503 #define dbm_delete(...) (pthread_testcancel(), dbm_delete(__VA_ARGS__))
    504 #define dbm_fetch(...) (pthread_testcancel(), dbm_fetch(__VA_ARGS__))
    505 #define dbm_nextkey(...) (pthread_testcancel(), dbm_nextkey(__VA_ARGS__))
    506 #define dbm_open(...) (pthread_testcancel(), dbm_open(__VA_ARGS__))
    507 #define dbm_store(...) (pthread_testcancel(), dbm_store(__VA_ARGS__))
    508 #define dlclose(...) (pthread_testcancel(), dlclose(__VA_ARGS__))
    509 #define dlopen(...) (pthread_testcancel(), dlopen(__VA_ARGS__))
    510 #define endgrent(...) (pthread_testcancel(), endgrent(__VA_ARGS__))
    511 #define endhostent(...) (pthread_testcancel(), endhostent(__VA_ARGS__))
    512 #define endnetent(...) (pthread_testcancel(), endnetent(__VA_ARGS__))
    513 #define endprotoent(...) (pthread_testcancel(), endprotoend(__VA_ARGS__))
    514 #define endpwent(...) (pthread_testcancel(), endpwent(__VA_ARGS__))
    515 #define endservent(...) (pthread_testcancel(), endservent(__VA_ARGS__))
    516 #define endutxent(...) (pthread_testcancel(), endutxent(__VA_ARGS__))
    517 #define fclose(...) (pthread_testcancel(), fclose(__VA_ARGS__))
    518 #define fflush(...) (pthread_testcancel(), fflush(__VA_ARGS__))
    519 #define fgetc(...) (pthread_testcancel(), fgetc(__VA_ARGS__))
    520 #define fgetpos(...) (pthread_testcancel(), fgetpos(__VA_ARGS__))
    521 #define fgets(...) (pthread_testcancel(), fgets(__VA_ARGS__))
    522 #define fgetwc(...) (pthread_testcancel(), fgetwc(__VA_ARGS__))
    523 #define fgetws(...) (pthread_testcancel(), fgetws(__VA_ARGS__))
    524 #define fmtmsg(...) (pthread_testcancel(), fmtmsg(__VA_ARGS__))
    525 #define fopen(...) (pthread_testcancel(), fopen(__VA_ARGS__))
    526 #define fpathconf(...) (pthread_testcancel(), fpathconf(__VA_ARGS__))
    527 #define fprintf(...) (pthread_testcancel(), fprintf(__VA_ARGS__))
    528 #define fputc(...) (pthread_testcancel(), fputc(__VA_ARGS__))
    529 #define fputs(...) (pthread_testcancel(), fputs(__VA_ARGS__))
    530 #define fputwc(...) (pthread_testcancel(), fputwc(__VA_ARGS__))
    531 #define fputws(...) (pthread_testcancel(), fputws(__VA_ARGS__))
    532 #define fread(...) (pthread_testcancel(), fread(__VA_ARGS__))
    533 #define freopen(...) (pthread_testcancel(), freopen(__VA_ARGS__))
    534 #define fscanf(...) (pthread_testcancel(), fscanf(__VA_ARGS__))
    535 #define fseek(...) (pthread_testcancel(), fseek(__VA_ARGS__))
    536 #define fseeko(...) (pthread_testcancel(), fseeko(__VA_ARGS__))
    537 #define fsetpos(...) (pthread_testcancel(), fsetpos(__VA_ARGS__))
    538 #define fstat(...) (pthread_testcancel(), fstat(__VA_ARGS__))
    539 #define ftell(...) (pthread_testcancel(), ftell(__VA_ARGS__))
    540 #define ftello(...) (pthread_testcancel(), ftello(__VA_ARGS__))
    541 #define ftw(...) (pthread_testcancel(), ftw(__VA_ARGS__))
    542 #define fwprintf(...) (pthread_testcancel(), fwprintf(__VA_ARGS__))
    543 #define fwrite(...) (pthread_testcancel(), fwrite(__VA_ARGS__))
    544 #define fwscanf(...) (pthread_testcancel(), fwscanf(__VA_ARGS__))
    545 #define getaddrinfo(...) (pthread_testcancel(), getaddrinfo(__VA_ARGS__))
    546 #define getc(...) (pthread_testcancel(), getc(__VA_ARGS__))
    547 #define getc_unlocked(...) (pthread_testcancel(), getc_unlocked(__VA_ARGS__))
    548 #define getchar(...) (pthread_testcancel(), getchar(__VA_ARGS__))
    549 #define getchar_unlocked(...) (pthread_testcancel(), getchar_unlocked(__VA_ARGS__))
    550 #define getcwd(...) (pthread_testcancel(), getcwd(__VA_ARGS__))
    551 #define getdate(...) (pthread_testcancel(), getdate(__VA_ARGS__))
    552 #define getgrent(...) (pthread_testcancel(), getgrent(__VA_ARGS__))
    553 #define getgrgid(...) (pthread_testcancel(), getgrgid(__VA_ARGS__))
    554 #define getgrgid_r(...) (pthread_testcancel(), getgrgid_r(__VA_ARGS__))
    555 #define gergrnam(...) (pthread_testcancel(), getgrnam(__VA_ARGS__))
    556 #define getgrnam_r(...) (pthread_testcancel(), getgrnam_r(__VA_ARGS__))
    557 #define gethostbyaddr(...) (pthread_testcancel(), gethostbyaddr(__VA_ARGS__))
    558 #define gethostbyname(...) (pthread_testcancel(), gethostbyname(__VA_ARGS__))
    559 #define gethostent(...) (pthread_testcancel(), gethostent(__VA_ARGS__))
    560 #define gethostid(...) (pthread_testcancel(), gethostid(__VA_ARGS__))
    561 #define gethostname(...) (pthread_testcancel(), gethostname(__VA_ARGS__))
    562 #define getlogin(...) (pthread_testcancel(), getlogin(__VA_ARGS__))
    563 #define getlogin_r(...) (pthread_testcancel(), getlogin_r(__VA_ARGS__))
    564 #define getnameinfo(...) (pthread_testcancel(), getnameinfo(__VA_ARGS__))
    565 #define getnetbyaddr(...) (pthread_testcancel(), getnetbyaddr(__VA_ARGS__))
    566 #define getnetbyname(...) (pthread_testcancel(), getnetbyname(__VA_ARGS__))
    567 #define getnetent(...) (pthread_testcancel(), getnetent(__VA_ARGS__))
    568 #define getopt(...) (pthread_testcancel(), getopt(__VA_ARGS__))
    569 #define getprotobyname(...) (pthread_testcancel(), getprotobyname(__VA_ARGS__))
    570 #define getprotobynumber(...) (pthread_testcancel(), getprotobynumber(__VA_ARGS__))
    571 #define getprotoent(...) (pthread_testcancel(), getprotoent(__VA_ARGS__))
    572 #define getpwent(...) (pthread_testcancel(), getpwent(__VA_ARGS__))
    573 #define getpwnam(...) (pthread_testcancel(), getpwnam(__VA_ARGS__))
    574 #define getpwnam_r(...) (pthread_testcancel(), getpwnam_r(__VA_ARGS__))
    575 #define getpwuid(...) (pthread_testcancel(), getpwuid(__VA_ARGS__))
    576 #define getpwuid_r(...) (pthread_testcancel(), getpwuid_r(__VA_ARGS__))
    577 #define gets(...) (pthread_testcancel(), gets(__VA_ARGS__))
    578 #define getservbyname(...) (pthread_testcancel(), getservbyname(__VA_ARGS__))
    579 #define getservbyport(...) (pthread_testcancel(), getservbyport(__VA_ARGS__))
    580 #define getservent(...) (pthread_testcancel(), getservent(__VA_ARGS__))
    581 #define getutxent(...) (pthread_testcancel(), getutxent(__VA_ARGS__))
    582 #define getutxid(...) (pthread_testcancel(), getutxid(__VA_ARGS__))
    583 #define getutxline(...) (pthread_testcancel(), getutxline(__VA_ARGS__))
    584 #undef getwc
    585 #define getwc(...) (pthread_testcancel(), getwc(__VA_ARGS__))
    586 #undef getwchar
    587 #define getwchar(...) (pthread_testcancel(), getwchar(__VA_ARGS__))
    588 #define getwd(...) (pthread_testcancel(), getwd(__VA_ARGS__))
    589 #define glob(...) (pthread_testcancel(), glob(__VA_ARGS__))
    590 #define iconv_close(...) (pthread_testcancel(), iconv_close(__VA_ARGS__))
    591 #define iconv_open(...) (pthread_testcancel(), iconv_open(__VA_ARGS__))
    592 #define ioctl(...) (pthread_testcancel(), ioctl(__VA_ARGS__))
    593 #define link(...) (pthread_testcancel(), link(__VA_ARGS__))
    594 #define localtime(...) (pthread_testcancel(), localtime(__VA_ARGS__))
    595 #define lseek(...) (pthread_testcancel(), lseek(__VA_ARGS__))
    596 #define lstat(...) (pthread_testcancel(), lstat(__VA_ARGS__))
    597 #define mkstemp(...) (pthread_testcancel(), mkstemp(__VA_ARGS__))
    598 #define nftw(...) (pthread_testcancel(), nftw(__VA_ARGS__))
    599 #define opendir(...) (pthread_testcancel(), opendir(__VA_ARGS__))
    600 #define openlog(...) (pthread_testcancel(), openlog(__VA_ARGS__))
    601 #define pathconf(...) (pthread_testcancel(), pathconf(__VA_ARGS__))
    602 #define pclose(...) (pthread_testcancel(), pclose(__VA_ARGS__))
    603 #define perror(...) (pthread_testcancel(), perror(__VA_ARGS__))
    604 #define popen(...) (pthread_testcancel(), popen(__VA_ARGS__))
    605 #define posix_fadvise(...) (pthread_testcancel(), posix_fadvise(__VA_ARGS__))
    606 #define posix_fallocate(...) (pthread_testcancel(), posix_fallocate(__VA_ARGS__))
    607 #define posix_madvise(...) (pthread_testcancel(), posix_madvise(__VA_ARGS__))
    608 #define posix_openpt(...) (pthread_testcancel(), posix_openpt(__VA_ARGS__))
    609 #define posix_spawn(...) (pthread_testcancel(), posix_spawn(__VA_ARGS__))
    610 #define posix_spawnp(...) (pthread_testcancel(), posix_spawnp(__VA_ARGS__))
    611 #define posix_trace_clear(...) (pthread_testcancel(), posix_trace_clear(__VA_ARGS__))
    612 #define posix_trace_close(...) (pthread_testcancel(), posix_trace_close(__VA_ARGS__))
    613 #define posix_trace_create(...) (pthread_testcancel(), posix_trace_create(__VA_ARGS__))
    614 #define posix_trace_create_withlog(...) (pthread_testcancel(), posix_trace_create_withlog(__VA_ARGS__))
    615 #define posix_trace_eventtypelist_getne(...) (pthread_testcancel(), posix_trace_eventtypelist_getne(__VA_ARGS__))
    616 #define posix_trace_eventtypelist_rewin(...) (pthread_testcancel(), posix_trace_eventtypelist_rewin(__VA_ARGS__))
    617 #define posix_trace_flush(...) (pthread_testcancel(), posix_trace_flush(__VA_ARGS__))
    618 #define posix_trace_get_attr(...) (pthread_testcancel(), posix_trace_get_attr(__VA_ARGS__))
    619 #define posix_trace_get_filter(...) (pthread_testcancel(), posix_trace_get_filter(__VA_ARGS__))
    620 #define posix_trace_get_status(...) (pthread_testcancel(), posix_trace_get_status(__VA_ARGS__))
    621 #define posix_trace_getnext_event(...) (pthread_testcancel(), posix_trace_getnext_event(__VA_ARGS__))
    622 #define posix_trace_open(...) (pthread_testcancel(), posix_trace_open(__VA_ARGS__))
    623 #define posix_trace_rewind(...) (pthread_testcancel(), posix_trace_rewind(__VA_ARGS__))
    624 #define posix_trace_setfilter(...) (pthread_testcancel(), posix_trace_setfilter(__VA_ARGS__))
    625 #define posix_trace_shutdown(...) (pthread_testcancel(), posix_trace_shutdown(__VA_ARGS__))
    626 #define posix_trace_timedgetnext_event(...) (pthread_testcancel(), posix_trace_timedgetnext_event(__VA_ARGS__))
    627 #define posix_typed_mem_open(...) (pthread_testcancel(), posix_typed_mem_open(__VA_ARGS__))
    628 #define printf(...) (pthread_testcancel(), printf(__VA_ARGS__))
    629 #define putc(...) (pthread_testcancel(), putc(__VA_ARGS__))
    630 #define putc_unlocked(...) (pthread_testcancel(), putc_unlocked(__VA_ARGS__))
    631 #define putchar(...) (pthread_testcancel(), putchar(__VA_ARGS__))
    632 #define putchar_unlocked(...) (pthread_testcancel(), putchar_unlocked(__VA_ARGS__))
    633 #define puts(...) (pthread_testcancel(), puts(__VA_ARGS__))
    634 #define pututxline(...) (pthread_testcancel(), pututxline(__VA_ARGS__))
    635 #undef putwc
    636 #define putwc(...) (pthread_testcancel(), putwc(__VA_ARGS__))
    637 #undef putwchar
    638 #define putwchar(...) (pthread_testcancel(), putwchar(__VA_ARGS__))
    639 #define readdir(...) (pthread_testcancel(), readdir(__VA_ARSG__))
    640 #define readdir_r(...) (pthread_testcancel(), readdir_r(__VA_ARGS__))
    641 #define remove(...) (pthread_testcancel(), remove(__VA_ARGS__))
    642 #define rename(...) (pthread_testcancel(), rename(__VA_ARGS__))
    643 #define rewind(...) (pthread_testcancel(), rewind(__VA_ARGS__))
    644 #define rewinddir(...) (pthread_testcancel(), rewinddir(__VA_ARGS__))
    645 #define scanf(...) (pthread_testcancel(), scanf(__VA_ARGS__))
    646 #define seekdir(...) (pthread_testcancel(), seekdir(__VA_ARGS__))
    647 #define semop(...) (pthread_testcancel(), semop(__VA_ARGS__))
    648 #define setgrent(...) (pthread_testcancel(), setgrent(__VA_ARGS__))
    649 #define sethostent(...) (pthread_testcancel(), sethostemt(__VA_ARGS__))
    650 #define setnetent(...) (pthread_testcancel(), setnetent(__VA_ARGS__))
    651 #define setprotoent(...) (pthread_testcancel(), setprotoent(__VA_ARGS__))
    652 #define setpwent(...) (pthread_testcancel(), setpwent(__VA_ARGS__))
    653 #define setservent(...) (pthread_testcancel(), setservent(__VA_ARGS__))
    654 #define setutxent(...) (pthread_testcancel(), setutxent(__VA_ARGS__))
    655 #define stat(...) (pthread_testcancel(), stat(__VA_ARGS__))
    656 #define strerror(...) (pthread_testcancel(), strerror(__VA_ARGS__))
    657 #define strerror_r(...) (pthread_testcancel(), strerror_r(__VA_ARGS__))
    658 #define strftime(...) (pthread_testcancel(), strftime(__VA_ARGS__))
    659 #define symlink(...) (pthread_testcancel(), symlink(__VA_ARGS__))
    660 #define sync(...) (pthread_testcancel(), sync(__VA_ARGS__))
    661 #define syslog(...) (pthread_testcancel(), syslog(__VA_ARGS__))
    662 #define tmpfile(...) (pthread_testcancel(), tmpfile(__VA_ARGS__))
    663 #define tmpnam(...) (pthread_testcancel(), tmpnam(__VA_ARGS__))
    664 #define ttyname(...) (pthread_testcancel(), ttyname(__VA_ARGS__))
    665 #define ttyname_r(...) (pthread_testcancel(), ttyname_r(__VA_ARGS__))
    666 #define tzset(...) (pthread_testcancel(), tzset(__VA_ARGS__))
    667 #define ungetc(...) (pthread_testcancel(), ungetc(__VA_ARGS__))
    668 #define ungetwc(...) (pthread_testcancel(), ungetwc(__VA_ARGS__))
    669 #define unlink(...) (pthread_testcancel(), unlink(__VA_ARGS__))
    670 #define vfprintf(...) (pthread_testcancel(), vfprintf(__VA_ARGS__))
    671 #define vfwprintf(...) (pthread_testcancel(), vfwprintf(__VA_ARGS__))
    672 #define vprintf(...) (pthread_testcancel(), vprintf(__VA_ARGS__))
    673 #define vwprintf(...) (pthread_testcancel(), vwprintf(__VA_ARGS__))
    674 #define wcsftime(...) (pthread_testcancel(), wcsftime(__VA_ARGS__))
    675 #define wordexp(...) (pthread_testcancel(), wordexp(__VA_ARGS__))
    676 #define wprintf(...) (pthread_testcancel(), wprintf(__VA_ARGS__))
    677 #define wscanf(...) (pthread_testcancel(), wscanf(__VA_ARGS__))
    678 #endif
    679 
    680 /* We deal here with a gcc issue for posix threading on Windows.
    681    We would need to change here gcc's gthr-posix.h header, but this
    682    got rejected.  So we deal it within this header.  */
    683 #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC
    684 #undef _GTHREAD_USE_MUTEX_INIT_FUNC
    685 #endif
    686 #define _GTHREAD_USE_MUTEX_INIT_FUNC 1
    687 
    688 #ifdef __cplusplus
    689 }
    690 #endif
    691 
    692 #endif /* WIN_PTHREADS_H */
    693