#if !defined( PTHREAD_H )
#define PTHREAD_H
#if !defined( __PTW32_CLEANUP_SEH ) && !defined( __PTW32_CLEANUP_CXX ) && !defined( __PTW32_CLEANUP_C )
# define __PTW32_CLEANUP_C
#endif
#if defined( __PTW32_CLEANUP_SEH ) && ( !defined( _MSC_VER ) && !defined (__PTW32_RC_MSC))
#error ERROR [__FILE__, line __LINE__]: SEH is not supported for this compiler.
#endif
#include <_ptw32.h>
#if !defined(RC_INVOKED)
#undef __PTW32_LEVEL
#undef __PTW32_LEVEL_MAX
#define __PTW32_LEVEL_MAX 3
#if _POSIX_C_SOURCE >= 200112L
# define __PTW32_LEVEL __PTW32_LEVEL_MAX
#elif defined INCLUDE_NP
# define __PTW32_LEVEL 2
#elif _POSIX_C_SOURCE >= 199309L
# define __PTW32_LEVEL 1
#elif defined _POSIX_SOURCE
# define __PTW32_LEVEL 0
#else
# define __PTW32_LEVEL __PTW32_LEVEL_MAX
#endif
enum
{
__PTW32_FALSE = 0,
__PTW32_TRUE = (! __PTW32_FALSE)
};
#include <time.h>
#include <sched.h>
#undef _POSIX_THREADS
#define _POSIX_THREADS 200809L
#undef _POSIX_READER_WRITER_LOCKS
#define _POSIX_READER_WRITER_LOCKS 200809L
#undef _POSIX_SPIN_LOCKS
#define _POSIX_SPIN_LOCKS 200809L
#undef _POSIX_BARRIERS
#define _POSIX_BARRIERS 200809L
#undef _POSIX_THREAD_SAFE_FUNCTIONS
#define _POSIX_THREAD_SAFE_FUNCTIONS 200809L
#undef _POSIX_THREAD_ATTR_STACKSIZE
#define _POSIX_THREAD_ATTR_STACKSIZE 200809L
#undef _POSIX_ROBUST_MUTEXES
#define _POSIX_ROBUST_MUTEXES 200809L
#undef _POSIX_THREAD_ATTR_STACKADDR
#define _POSIX_THREAD_ATTR_STACKADDR -1
#undef _POSIX_THREAD_PRIO_INHERIT
#define _POSIX_THREAD_PRIO_INHERIT -1
#undef _POSIX_THREAD_PRIO_PROTECT
#define _POSIX_THREAD_PRIO_PROTECT -1
#undef _POSIX_THREAD_PRIORITY_SCHEDULING
#define _POSIX_THREAD_PRIORITY_SCHEDULING -1
#undef _POSIX_THREAD_PROCESS_SHARED
#define _POSIX_THREAD_PROCESS_SHARED -1
#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
#undef PTHREAD_DESTRUCTOR_ITERATIONS
#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
#undef _POSIX_THREAD_KEYS_MAX
#define _POSIX_THREAD_KEYS_MAX 128
#undef PTHREAD_KEYS_MAX
#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX
#undef PTHREAD_STACK_MIN
#define PTHREAD_STACK_MIN 0
#undef _POSIX_THREAD_THREADS_MAX
#define _POSIX_THREAD_THREADS_MAX 64
#undef PTHREAD_THREADS_MAX
#define PTHREAD_THREADS_MAX 2019
#undef _POSIX_SEM_NSEMS_MAX
#define _POSIX_SEM_NSEMS_MAX 256
#undef SEM_NSEMS_MAX
#define SEM_NSEMS_MAX 1024
#undef _POSIX_SEM_VALUE_MAX
#define _POSIX_SEM_VALUE_MAX 32767
#undef SEM_VALUE_MAX
#define SEM_VALUE_MAX INT_MAX
#if defined(_UWIN) && __PTW32_LEVEL >= __PTW32_LEVEL_MAX
# include <sys/types.h>
#else
typedef struct
{ void * p;
#if __PTW32_VERSION_MAJOR > 2
size_t x;
#else
unsigned int x;
#endif
} __ptw32_handle_t;
typedef __ptw32_handle_t pthread_t;
typedef struct pthread_attr_t_ * pthread_attr_t;
typedef struct pthread_once_t_ pthread_once_t;
typedef struct pthread_key_t_ * pthread_key_t;
typedef struct pthread_mutex_t_ * pthread_mutex_t;
typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t;
typedef struct pthread_cond_t_ * pthread_cond_t;
typedef struct pthread_condattr_t_ * pthread_condattr_t;
#endif
typedef struct pthread_rwlock_t_ * pthread_rwlock_t;
typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t;
typedef struct pthread_spinlock_t_ * pthread_spinlock_t;
typedef struct pthread_barrier_t_ * pthread_barrier_t;
typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t;
enum
{
PTHREAD_CREATE_JOINABLE = 0,
PTHREAD_CREATE_DETACHED = 1,
PTHREAD_INHERIT_SCHED = 0,
PTHREAD_EXPLICIT_SCHED = 1,
PTHREAD_SCOPE_PROCESS = 0,
PTHREAD_SCOPE_SYSTEM = 1,
PTHREAD_CANCEL_ENABLE = 0,
PTHREAD_CANCEL_DISABLE = 1,
PTHREAD_CANCEL_ASYNCHRONOUS = 0,
PTHREAD_CANCEL_DEFERRED = 1,
PTHREAD_PROCESS_PRIVATE = 0,
PTHREAD_PROCESS_SHARED = 1,
PTHREAD_MUTEX_STALLED = 0,
PTHREAD_MUTEX_ROBUST = 1,
PTHREAD_BARRIER_SERIAL_THREAD = -1
};
#define PTHREAD_CANCELED ((void *)(size_t) -1)
#if __PTW32_VERSION_MAJOR > 2
#define PTHREAD_ONCE_INIT { 0, __PTW32_FALSE }
struct pthread_once_t_
{
void * lock;
int done;
};
#else
#define PTHREAD_ONCE_INIT { __PTW32_FALSE, 0, 0, 0 }
struct pthread_once_t_
{
int done;
void * lock;
int reserved1;
int reserved2;
};
#endif
#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -1)
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -2)
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t)(size_t) -3)
#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER
#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER
#define PTHREAD_COND_INITIALIZER ((pthread_cond_t)(size_t) -1)
#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t)(size_t) -1)
#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t)(size_t) -1)
enum
{
PTHREAD_MUTEX_FAST_NP,
PTHREAD_MUTEX_RECURSIVE_NP,
PTHREAD_MUTEX_ERRORCHECK_NP,
PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP,
PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP,
PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP,
PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP,
PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP,
PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL
};
typedef struct __ptw32_cleanup_t __ptw32_cleanup_t;
#if defined(_MSC_VER)
#pragma warning( disable : 4229 )
#endif
typedef void (* __PTW32_CDECL __ptw32_cleanup_callback_t)(void *);
#if defined(_MSC_VER)
#pragma warning( default : 4229 )
#endif
struct __ptw32_cleanup_t
{
__ptw32_cleanup_callback_t routine;
void *arg;
struct __ptw32_cleanup_t *prev;
};
#if defined(__PTW32_CLEANUP_SEH)
#define pthread_cleanup_push( _rout, _arg ) \
{ \
__ptw32_cleanup_t _cleanup; \
\
_cleanup.routine = (__ptw32_cleanup_callback_t)(_rout); \
_cleanup.arg = (_arg); \
__try \
{ \
#define pthread_cleanup_pop( _execute ) \
} \
__finally \
{ \
if( _execute || AbnormalTermination()) \
{ \
(*(_cleanup.routine))( _cleanup.arg ); \
} \
} \
}
#else
#if defined(__PTW32_CLEANUP_C)
#define pthread_cleanup_push( _rout, _arg ) \
{ \
__ptw32_cleanup_t _cleanup; \
\
__ptw32_push_cleanup( &_cleanup, (__ptw32_cleanup_callback_t) (_rout), (_arg) ); \
#define pthread_cleanup_pop( _execute ) \
(void) __ptw32_pop_cleanup( _execute ); \
}
#else
#if defined(__PTW32_CLEANUP_CXX)
class PThreadCleanup {
__ptw32_cleanup_callback_t cleanUpRout;
void * obj;
int executeIt;
public:
PThreadCleanup() :
cleanUpRout( 0 ),
obj( 0 ),
executeIt( 0 )
{
}
PThreadCleanup(
__ptw32_cleanup_callback_t routine,
void * arg ) :
cleanUpRout( routine ),
obj( arg ),
executeIt( 1 )
{
}
~PThreadCleanup()
{
if ( executeIt && ((void *) cleanUpRout != (void *) 0) )
{
(void) (*cleanUpRout)( obj );
}
}
void execute( int exec )
{
executeIt = exec;
}
};
#define pthread_cleanup_push( _rout, _arg ) \
{ \
PThreadCleanup cleanup((__ptw32_cleanup_callback_t)(_rout), \
(void *) (_arg) );
#define pthread_cleanup_pop( _execute ) \
cleanup.execute( _execute ); \
}
#else
#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined.
#endif
#endif
#endif
__PTW32_BEGIN_C_DECLS
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_init (pthread_attr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_getaffinity_np (const pthread_attr_t * attr,
size_t cpusetsize,
cpu_set_t * cpuset);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr,
int *detachstate);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr,
void **stackaddr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr,
size_t * stacksize);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_setaffinity_np (pthread_attr_t * attr,
size_t cpusetsize,
const cpu_set_t * cpuset);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr,
int detachstate);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr,
void *stackaddr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr,
size_t stacksize);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr,
struct sched_param *param);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr,
const struct sched_param *param);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *,
int);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_getschedpolicy (const pthread_attr_t *,
int *);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr,
int inheritsched);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_getinheritsched(const pthread_attr_t * attr,
int * inheritsched);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_setscope (pthread_attr_t *,
int);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *,
int *);
__PTW32_DLLPORT int __PTW32_CDECL pthread_create (pthread_t * tid,
const pthread_attr_t * attr,
void * (__PTW32_CDECL *start) (void *),
void *arg);
__PTW32_DLLPORT int __PTW32_CDECL pthread_detach (pthread_t tid);
__PTW32_DLLPORT int __PTW32_CDECL pthread_equal (pthread_t t1,
pthread_t t2);
__PTW32_DLLPORT void __PTW32_CDECL pthread_exit (void *value_ptr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_join (pthread_t thread,
void **value_ptr);
__PTW32_DLLPORT pthread_t __PTW32_CDECL pthread_self (void);
__PTW32_DLLPORT int __PTW32_CDECL pthread_cancel (pthread_t thread);
__PTW32_DLLPORT int __PTW32_CDECL pthread_setcancelstate (int state,
int *oldstate);
__PTW32_DLLPORT int __PTW32_CDECL pthread_setcanceltype (int type,
int *oldtype);
__PTW32_DLLPORT void __PTW32_CDECL pthread_testcancel (void);
__PTW32_DLLPORT int __PTW32_CDECL pthread_once (pthread_once_t * once_control,
void (__PTW32_CDECL *init_routine) (void));
#if __PTW32_LEVEL >= __PTW32_LEVEL_MAX
__PTW32_DLLPORT __ptw32_cleanup_t * __PTW32_CDECL __ptw32_pop_cleanup (int execute);
__PTW32_DLLPORT void __PTW32_CDECL __ptw32_push_cleanup (__ptw32_cleanup_t * cleanup,
__ptw32_cleanup_callback_t routine,
void *arg);
#endif
__PTW32_DLLPORT int __PTW32_CDECL pthread_key_create (pthread_key_t * key,
void (__PTW32_CDECL *destructor) (void *));
__PTW32_DLLPORT int __PTW32_CDECL pthread_key_delete (pthread_key_t key);
__PTW32_DLLPORT int __PTW32_CDECL pthread_setspecific (pthread_key_t key,
const void *value);
__PTW32_DLLPORT void * __PTW32_CDECL pthread_getspecific (pthread_key_t key);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t
* attr,
int *pshared);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
int pshared);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutexattr_gettype (const pthread_mutexattr_t * attr, int *kind);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutexattr_setrobust(
pthread_mutexattr_t *attr,
int robust);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutexattr_getrobust(
const pthread_mutexattr_t * attr,
int * robust);
__PTW32_DLLPORT int __PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t
* attr,
int *pshared);
__PTW32_DLLPORT int __PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
int pshared);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex,
const pthread_mutexattr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t * mutex,
const struct timespec *abstime);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutex_consistent (pthread_mutex_t * mutex);
__PTW32_DLLPORT int __PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared);
__PTW32_DLLPORT int __PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock);
__PTW32_DLLPORT int __PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock);
__PTW32_DLLPORT int __PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock);
__PTW32_DLLPORT int __PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock);
__PTW32_DLLPORT int __PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier,
const pthread_barrierattr_t * attr,
unsigned int count);
__PTW32_DLLPORT int __PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier);
__PTW32_DLLPORT int __PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier);
__PTW32_DLLPORT int __PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr,
int *pshared);
__PTW32_DLLPORT int __PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr,
int pshared);
__PTW32_DLLPORT int __PTW32_CDECL pthread_cond_init (pthread_cond_t * cond,
const pthread_condattr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond);
__PTW32_DLLPORT int __PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond,
pthread_mutex_t * mutex);
__PTW32_DLLPORT int __PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond,
pthread_mutex_t * mutex,
const struct timespec *abstime);
__PTW32_DLLPORT int __PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond);
__PTW32_DLLPORT int __PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond);
__PTW32_DLLPORT int __PTW32_CDECL pthread_setschedparam (pthread_t thread,
int policy,
const struct sched_param *param);
__PTW32_DLLPORT int __PTW32_CDECL pthread_getschedparam (pthread_t thread,
int *policy,
struct sched_param *param);
__PTW32_DLLPORT int __PTW32_CDECL pthread_setconcurrency (int);
__PTW32_DLLPORT int __PTW32_CDECL pthread_getconcurrency (void);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock,
const pthread_rwlockattr_t *attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock,
const struct timespec *abstime);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock,
const struct timespec *abstime);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr,
int *pshared);
__PTW32_DLLPORT int __PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr,
int pshared);
#if __PTW32_LEVEL >= __PTW32_LEVEL_MAX - 1
__PTW32_DLLPORT int __PTW32_CDECL pthread_kill(pthread_t thread, int sig);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr,
int kind);
__PTW32_DLLPORT int __PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr,
int *kind);
__PTW32_DLLPORT int __PTW32_CDECL pthread_timedjoin_np(pthread_t thread,
void **value_ptr,
const struct timespec *abstime);
__PTW32_DLLPORT int __PTW32_CDECL pthread_tryjoin_np(pthread_t thread,
void **value_ptr);
__PTW32_DLLPORT int __PTW32_CDECL pthread_setaffinity_np(pthread_t thread,
size_t cpusetsize,
const cpu_set_t *cpuset);
__PTW32_DLLPORT int __PTW32_CDECL pthread_getaffinity_np(pthread_t thread,
size_t cpusetsize,
cpu_set_t *cpuset);
__PTW32_DLLPORT int __PTW32_CDECL pthread_delay_np (struct timespec * interval);
__PTW32_DLLPORT int __PTW32_CDECL pthread_num_processors_np(void);
__PTW32_DLLPORT unsigned __int64 __PTW32_CDECL pthread_getunique_np(pthread_t thread);
__PTW32_DLLPORT int __PTW32_CDECL pthread_win32_process_attach_np(void);
__PTW32_DLLPORT int __PTW32_CDECL pthread_win32_process_detach_np(void);
__PTW32_DLLPORT int __PTW32_CDECL pthread_win32_thread_attach_np(void);
__PTW32_DLLPORT int __PTW32_CDECL pthread_win32_thread_detach_np(void);
__PTW32_DLLPORT struct timespec * __PTW32_CDECL pthread_win32_getabstime_np(
struct timespec * abstime,
const struct timespec * relative);
__PTW32_DLLPORT int __PTW32_CDECL pthread_win32_test_features_np(int);
enum __ptw32_features
{
__PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001,
__PTW32_ALERTABLE_ASYNC_CANCEL = 0x0002
};
__PTW32_DLLPORT void * __PTW32_CDECL pthread_timechange_handler_np(void *);
#endif
#if __PTW32_LEVEL >= __PTW32_LEVEL_MAX
__PTW32_DLLPORT void * __PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread);
__PTW32_DLLPORT unsigned long __PTW32_CDECL pthread_getw32threadid_np (pthread_t thread);
#if defined (__PTW32_COMPATIBILITY_BSD) || defined (__PTW32_COMPATIBILITY_TRU64)
#define PTHREAD_MAX_NAMELEN_NP 16
__PTW32_DLLPORT int __PTW32_CDECL pthread_setname_np (pthread_t thr, const char * name, void * arg);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_setname_np (pthread_attr_t * attr, const char * name, void * arg);
#else
__PTW32_DLLPORT int __PTW32_CDECL pthread_setname_np (pthread_t thr, const char * name);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_setname_np (pthread_attr_t * attr, const char * name);
#endif
__PTW32_DLLPORT int __PTW32_CDECL pthread_getname_np (pthread_t thr, char * name, int len);
__PTW32_DLLPORT int __PTW32_CDECL pthread_attr_getname_np (pthread_attr_t * attr, char * name, int len);
__PTW32_DLLPORT int __PTW32_CDECL pthreadCancelableWait (void *waitHandle);
__PTW32_DLLPORT int __PTW32_CDECL pthreadCancelableTimedWait (void *waitHandle,
unsigned long timeout);
#endif
#if defined(__WATCOMC__) && !defined(errno)
# if defined(_MT) || defined(_DLL)
__declspec(dllimport) extern int * __cdecl _errno(void);
# define errno (*_errno())
# endif
#endif
#if defined (__PTW32_USES_SEPARATE_CRT) && (defined(__PTW32_CLEANUP_CXX) || defined(__PTW32_CLEANUP_SEH))
typedef void (*__ptw32_terminate_handler)();
__PTW32_DLLPORT __ptw32_terminate_handler __PTW32_CDECL pthread_win32_set_terminate_np(__ptw32_terminate_handler termFunction);
#endif
#if defined(__cplusplus)
class __ptw32_exception {};
class __ptw32_exception_cancel : public __ptw32_exception {};
class __ptw32_exception_exit : public __ptw32_exception {};
#endif
#if __PTW32_LEVEL >= __PTW32_LEVEL_MAX
__PTW32_DLLPORT unsigned long __PTW32_CDECL __ptw32_get_exception_services_code(void);
#endif
#if !defined (__PTW32_BUILD)
#if defined(__PTW32_CLEANUP_SEH)
#define __except( E ) \
__except( ( GetExceptionCode() == __ptw32_get_exception_services_code() ) \
? EXCEPTION_CONTINUE_SEARCH : ( E ) )
#endif
#if defined(__PTW32_CLEANUP_CXX)
#if defined(_MSC_VER)
#if !defined(__PtW32NoCatchWarn)
#pragma message("Specify \"/D__PtW32NoCatchWarn\" compiler flag to skip this message.")
#pragma message("------------------------------------------------------------------")
#pragma message("When compiling applications with MSVC++ and C++ exception handling:")
#pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads")
#pragma message(" with '__PtW32CatchAll' or 'CATCHALL' if you want POSIX thread")
#pragma message(" cancellation and pthread_exit to work. For example:")
#pragma message("")
#pragma message(" #if defined(__PtW32CatchAll)")
#pragma message(" __PtW32CatchAll")
#pragma message(" #else")
#pragma message(" catch(...)")
#pragma message(" #endif")
#pragma message(" {")
#pragma message(" ")
#pragma message(" }")
#pragma message("------------------------------------------------------------------")
#endif
#define __PtW32CatchAll \
catch( __ptw32_exception & ) { throw; } \
catch( ... )
#else
#define catch( E ) \
catch( __ptw32_exception & ) { throw; } \
catch( E )
#endif
#endif
#endif
__PTW32_END_C_DECLS
#undef __PTW32_LEVEL
#undef __PTW32_LEVEL_MAX
#endif
#endif