summaryrefslogtreecommitdiff
path: root/pthread.h
diff options
context:
space:
mode:
authorrpj <rpj>2003-10-15 03:02:28 +0000
committerrpj <rpj>2003-10-15 03:02:28 +0000
commit41f042479e78dc0ce4daa8fd85ef59f61bb56325 (patch)
tree39b504ca5ff02a3198dd18f552cc2bbf05aaa279 /pthread.h
parentaf1871fba4fc253b5a31e4a0eed667fe79f534d7 (diff)
Add Watcom compiler compatibility.
Diffstat (limited to 'pthread.h')
-rw-r--r--pthread.h889
1 files changed, 455 insertions, 434 deletions
diff --git a/pthread.h b/pthread.h
index 35b2828..34cacc0 100644
--- a/pthread.h
+++ b/pthread.h
@@ -61,7 +61,7 @@
#ifdef _UWIN
# define HAVE_STRUCT_TIMESPEC 1
-# define HAVE_SIGNAL_H 1
+# define HAVE_SIGNAL_H 1
# undef HAVE_CONFIG_H
# pragma comment(lib, "pthread")
#endif
@@ -73,68 +73,68 @@
* Module: pthread.h
*
* Purpose:
- * Provides an implementation of PThreads based upon the
- * standard:
+ * Provides an implementation of PThreads based upon the
+ * standard:
*
- * POSIX 1003.1-2001
+ * POSIX 1003.1-2001
* and
* The Single Unix Specification version 3
*
* (these two are equivalent)
*
- * in order to enhance code portability between Windows,
+ * in order to enhance code portability between Windows,
* various commercial Unix implementations, and Linux.
*
- * See the ANNOUNCE file for a full list of conforming
- * routines and defined constants, and a list of missing
- * routines and constants not defined in this implementation.
+ * See the ANNOUNCE file for a full list of conforming
+ * routines and defined constants, and a list of missing
+ * routines and constants not defined in this implementation.
*
* Authors:
- * There have been many contributors to this library.
- * The initial implementation was contributed by
- * John Bossom, and several others have provided major
- * sections or revisions of parts of the implementation.
- * Often significant effort has been contributed to
- * find and fix important bugs and other problems to
- * improve the reliability of the library, which sometimes
- * is not reflected in the amount of code which changed as
- * result.
- * As much as possible, the contributors are acknowledged
- * in the ChangeLog file in the source code distribution
- * where their changes are noted in detail.
+ * There have been many contributors to this library.
+ * The initial implementation was contributed by
+ * John Bossom, and several others have provided major
+ * sections or revisions of parts of the implementation.
+ * Often significant effort has been contributed to
+ * find and fix important bugs and other problems to
+ * improve the reliability of the library, which sometimes
+ * is not reflected in the amount of code which changed as
+ * result.
+ * As much as possible, the contributors are acknowledged
+ * in the ChangeLog file in the source code distribution
+ * where their changes are noted in detail.
*
- * Contributors are listed in the CONTRIBUTORS file.
+ * Contributors are listed in the CONTRIBUTORS file.
*
- * As usual, all bouquets go to the contributors, and all
- * brickbats go to the project maintainer.
+ * As usual, all bouquets go to the contributors, and all
+ * brickbats go to the project maintainer.
*
* Maintainer:
- * The code base for this project is coordinated and
- * eventually pre-tested, packaged, and made available by
+ * The code base for this project is coordinated and
+ * eventually pre-tested, packaged, and made available by
*
- * Ross Johnson <rpj@ise.canberra.edu.au>
+ * Ross Johnson <rpj@ise.canberra.edu.au>
*
* QA Testers:
- * Ultimately, the library is tested in the real world by
- * a host of competent and demanding scientists and
- * engineers who report bugs and/or provide solutions
- * which are then fixed or incorporated into subsequent
- * versions of the library. Each time a bug is fixed, a
- * test case is written to prove the fix and ensure
- * that later changes to the code don't reintroduce the
- * same error. The number of test cases is slowly growing
- * and therefore so is the code reliability.
+ * Ultimately, the library is tested in the real world by
+ * a host of competent and demanding scientists and
+ * engineers who report bugs and/or provide solutions
+ * which are then fixed or incorporated into subsequent
+ * versions of the library. Each time a bug is fixed, a
+ * test case is written to prove the fix and ensure
+ * that later changes to the code don't reintroduce the
+ * same error. The number of test cases is slowly growing
+ * and therefore so is the code reliability.
*
* Compliance:
- * See the file ANNOUNCE for the list of implemented
- * and not-implemented routines and defined options.
- * Of course, these are all defined is this file as well.
+ * See the file ANNOUNCE for the list of implemented
+ * and not-implemented routines and defined options.
+ * Of course, these are all defined is this file as well.
*
* Web site:
- * The source code and other information about this library
- * are available from
+ * The source code and other information about this library
+ * are available from
*
- * http://sources.redhat.com/pthreads-win32/
+ * http://sources.redhat.com/pthreads-win32/
*
* -------------------------------------------------------------
*/
@@ -269,8 +269,8 @@ enum {
#ifndef HAVE_STRUCT_TIMESPEC
struct timespec {
- long tv_sec;
- long tv_nsec;
+ long tv_sec;
+ long tv_nsec;
};
#endif /* HAVE_STRUCT_TIMESPEC */
@@ -289,7 +289,7 @@ struct timespec {
#ifdef __cplusplus
extern "C"
{
-#endif /* __cplusplus */
+#endif /* __cplusplus */
/*
* -------------------------------------------------------------
@@ -298,108 +298,108 @@ extern "C"
* =========================
*
* _POSIX_THREADS (set)
- * If set, you can use threads
+ * If set, you can use threads
*
* _POSIX_THREAD_ATTR_STACKSIZE (set)
- * If set, you can control the size of a thread's
- * stack
- * pthread_attr_getstacksize
- * pthread_attr_setstacksize
+ * If set, you can control the size of a thread's
+ * stack
+ * pthread_attr_getstacksize
+ * pthread_attr_setstacksize
*
* _POSIX_THREAD_ATTR_STACKADDR (not set)
- * If set, you can allocate and control a thread's
- * stack. If not supported, the following functions
- * will return ENOSYS, indicating they are not
- * supported:
- * pthread_attr_getstackaddr
- * pthread_attr_setstackaddr
+ * If set, you can allocate and control a thread's
+ * stack. If not supported, the following functions
+ * will return ENOSYS, indicating they are not
+ * supported:
+ * pthread_attr_getstackaddr
+ * pthread_attr_setstackaddr
*
* _POSIX_THREAD_PRIORITY_SCHEDULING (set)
- * If set, you can use realtime scheduling.
- * Indicates the availability of:
- * pthread_attr_getinheritsched
- * pthread_attr_getschedparam
- * pthread_attr_getschedpolicy
- * pthread_attr_getscope
- * pthread_attr_setinheritsched
- * pthread_attr_setschedparam
- * pthread_attr_setschedpolicy
- * pthread_attr_setscope
- * pthread_getschedparam
- * pthread_setschedparam
- * sched_get_priority_max
- * sched_get_priority_min
- * sched_rr_set_interval
+ * If set, you can use realtime scheduling.
+ * Indicates the availability of:
+ * pthread_attr_getinheritsched
+ * pthread_attr_getschedparam
+ * pthread_attr_getschedpolicy
+ * pthread_attr_getscope
+ * pthread_attr_setinheritsched
+ * pthread_attr_setschedparam
+ * pthread_attr_setschedpolicy
+ * pthread_attr_setscope
+ * pthread_getschedparam
+ * pthread_setschedparam
+ * sched_get_priority_max
+ * sched_get_priority_min
+ * sched_rr_set_interval
*
* _POSIX_THREAD_PRIO_INHERIT (not set)
- * If set, you can create priority inheritance
- * mutexes.
- * pthread_mutexattr_getprotocol +
- * pthread_mutexattr_setprotocol +
+ * If set, you can create priority inheritance
+ * mutexes.
+ * pthread_mutexattr_getprotocol +
+ * pthread_mutexattr_setprotocol +
*
* _POSIX_THREAD_PRIO_PROTECT (not set)
- * If set, you can create priority ceiling mutexes
- * Indicates the availability of:
- * pthread_mutex_getprioceiling
- * pthread_mutex_setprioceiling
- * pthread_mutexattr_getprioceiling
- * pthread_mutexattr_getprotocol +
- * pthread_mutexattr_setprioceiling
- * pthread_mutexattr_setprotocol +
+ * If set, you can create priority ceiling mutexes
+ * Indicates the availability of:
+ * pthread_mutex_getprioceiling
+ * pthread_mutex_setprioceiling
+ * pthread_mutexattr_getprioceiling
+ * pthread_mutexattr_getprotocol +
+ * pthread_mutexattr_setprioceiling
+ * pthread_mutexattr_setprotocol +
*
* _POSIX_THREAD_PROCESS_SHARED (not set)
- * If set, you can create mutexes and condition
- * variables that can be shared with another
- * process.If set, indicates the availability
- * of:
- * pthread_mutexattr_getpshared
- * pthread_mutexattr_setpshared
- * pthread_condattr_getpshared
- * pthread_condattr_setpshared
+ * If set, you can create mutexes and condition
+ * variables that can be shared with another
+ * process.If set, indicates the availability
+ * of:
+ * pthread_mutexattr_getpshared
+ * pthread_mutexattr_setpshared
+ * pthread_condattr_getpshared
+ * pthread_condattr_setpshared
*
* _POSIX_THREAD_SAFE_FUNCTIONS (set)
- * If set you can use the special *_r library
- * functions that provide thread-safe behaviour
+ * If set you can use the special *_r library
+ * functions that provide thread-safe behaviour
*
* _POSIX_READER_WRITER_LOCKS (set)
- * If set, you can use read/write locks
+ * If set, you can use read/write locks
*
* _POSIX_SPIN_LOCKS (set)
- * If set, you can use spin locks
+ * If set, you can use spin locks
*
* _POSIX_BARRIERS (set)
- * If set, you can use barriers
+ * If set, you can use barriers
*
- * + These functions provide both 'inherit' and/or
- * 'protect' protocol, based upon these macro
- * settings.
+ * + These functions provide both 'inherit' and/or
+ * 'protect' protocol, based upon these macro
+ * settings.
*
* POSIX 1003.1-2001 Limits
* ===========================
*
* PTHREAD_DESTRUCTOR_ITERATIONS
- * Maximum number of attempts to destroy
- * a thread's thread-specific data on
- * termination (must be at least 4)
+ * Maximum number of attempts to destroy
+ * a thread's thread-specific data on
+ * termination (must be at least 4)
*
* PTHREAD_KEYS_MAX
- * Maximum number of thread-specific data keys
- * available per process (must be at least 128)
+ * Maximum number of thread-specific data keys
+ * available per process (must be at least 128)
*
* PTHREAD_STACK_MIN
- * Minimum supported stack size for a thread
+ * Minimum supported stack size for a thread
*
* PTHREAD_THREADS_MAX
- * Maximum number of threads supported per
- * process (must be at least 64).
+ * Maximum number of threads supported per
+ * process (must be at least 64).
*
* _POSIX_SEM_NSEMS_MAX
- * The maximum number of semaphores a process can have.
- * (only defined if not already defined)
+ * The maximum number of semaphores a process can have.
+ * (only defined if not already defined)
*
* _POSIX_SEM_VALUE_MAX
- * The maximum value a semaphore can have.
- * (only defined if not already defined)
+ * The maximum value a semaphore can have.
+ * (only defined if not already defined)
*
* -------------------------------------------------------------
*/
@@ -436,47 +436,47 @@ extern "C"
#define _POSIX_THREAD_PRIO_PROTECT
#define _POSIX_THREAD_PROCESS_SHARED
-#endif /* KLUDGE */
+#endif /* KLUDGE */
/*
* POSIX Limits
*
- * PTHREAD_DESTRUCTOR_ITERATIONS
- * Standard states this must be at least
- * 4.
+ * PTHREAD_DESTRUCTOR_ITERATIONS
+ * Standard states this must be at least
+ * 4.
*
- * PTHREAD_KEYS_MAX
- * WIN32 permits only 64 TLS keys per process.
- * This limitation could be worked around by
- * simply simulating keys.
+ * PTHREAD_KEYS_MAX
+ * WIN32 permits only 64 TLS keys per process.
+ * This limitation could be worked around by
+ * simply simulating keys.
*
- * PTHREADS_STACK_MIN
- * POSIX specifies 0 which is also the value WIN32
- * interprets as allowing the system to
- * set the size to that of the main thread. The
- * maximum stack size in Win32 is 1Meg. WIN32
- * allocates more stack as required up to the 1Meg
- * limit.
+ * PTHREADS_STACK_MIN
+ * POSIX specifies 0 which is also the value WIN32
+ * interprets as allowing the system to
+ * set the size to that of the main thread. The
+ * maximum stack size in Win32 is 1Meg. WIN32
+ * allocates more stack as required up to the 1Meg
+ * limit.
*
- * PTHREAD_THREADS_MAX
- * Not documented by WIN32. Wrote a test program
- * that kept creating threads until it failed
- * revealed this approximate number (Windows NT).
- * This number is somewhat less for Windows 9x
- * and is effectively less than 64. Perhaps this
- * constant should be set at DLL load time.
+ * PTHREAD_THREADS_MAX
+ * Not documented by WIN32. Wrote a test program
+ * that kept creating threads until it failed
+ * revealed this approximate number (Windows NT).
+ * This number is somewhat less for Windows 9x
+ * and is effectively less than 64. Perhaps this
+ * constant should be set at DLL load time.
*
*/
-#define PTHREAD_DESTRUCTOR_ITERATIONS 4
-#define PTHREAD_KEYS_MAX 64
-#define PTHREAD_STACK_MIN 0
-#define PTHREAD_THREADS_MAX 2019
+#define PTHREAD_DESTRUCTOR_ITERATIONS 4
+#define PTHREAD_KEYS_MAX 64
+#define PTHREAD_STACK_MIN 0
+#define PTHREAD_THREADS_MAX 2019
#ifndef _POSIX_SEM_NSEMS_MAX
/* Not used and only an arbitrary value. */
-# define _POSIX_SEM_NSEMS_MAX 1024
+# define _POSIX_SEM_NSEMS_MAX 1024
#endif
#ifndef _POSIX_SEM_VALUE_MAX
-# define _POSIX_SEM_VALUE_MAX (INT_MAX/2)
+# define _POSIX_SEM_VALUE_MAX (INT_MAX/2)
#endif
#if __GNUC__ && ! defined (__declspec)
@@ -497,8 +497,19 @@ extern "C"
# endif
#endif
+/*
+ * The Open Watcom C/C++ compiler uses a non-standard calling convention
+ * that passes function args in registers unless __cdecl is explicitly specified
+ * in function prototypes.
+ *
+ * We force all calls to cdecl even though this will slow Watcom code down
+ * slightly. If you know that the Watcom compiler will be used to build both
+ * the DLL and application, then you could probably define this as a null string.
+ */
+#define PTW32_CDECL __cdecl
+
#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX
-# include <sys/types.h>
+# include <sys/types.h>
#else
typedef struct pthread_t_ *pthread_t;
typedef struct pthread_attr_t_ *pthread_attr_t;
@@ -527,39 +538,39 @@ enum {
/*
* pthread_attr_{get,set}detachstate
*/
- PTHREAD_CREATE_JOINABLE = 0, /* Default */
- PTHREAD_CREATE_DETACHED = 1,
+ PTHREAD_CREATE_JOINABLE = 0, /* Default */
+ PTHREAD_CREATE_DETACHED = 1,
/*
* pthread_attr_{get,set}inheritsched
*/
- PTHREAD_INHERIT_SCHED = 0,
- PTHREAD_EXPLICIT_SCHED = 1, /* Default */
+ PTHREAD_INHERIT_SCHED = 0,
+ PTHREAD_EXPLICIT_SCHED = 1, /* Default */
/*
* pthread_{get,set}scope
*/
- PTHREAD_SCOPE_PROCESS = 0,
- PTHREAD_SCOPE_SYSTEM = 1, /* Default */
+ PTHREAD_SCOPE_PROCESS = 0,
+ PTHREAD_SCOPE_SYSTEM = 1, /* Default */
/*
* pthread_setcancelstate paramters
*/
- PTHREAD_CANCEL_ENABLE = 0, /* Default */
- PTHREAD_CANCEL_DISABLE = 1,
+ PTHREAD_CANCEL_ENABLE = 0, /* Default */
+ PTHREAD_CANCEL_DISABLE = 1,
/*
* pthread_setcanceltype parameters
*/
- PTHREAD_CANCEL_ASYNCHRONOUS = 0,
- PTHREAD_CANCEL_DEFERRED = 1, /* Default */
+ PTHREAD_CANCEL_ASYNCHRONOUS = 0,
+ PTHREAD_CANCEL_DEFERRED = 1, /* Default */
/*
* pthread_mutexattr_{get,set}pshared
* pthread_condattr_{get,set}pshared
*/
- PTHREAD_PROCESS_PRIVATE = 0,
- PTHREAD_PROCESS_SHARED = 1,
+ PTHREAD_PROCESS_PRIVATE = 0,
+ PTHREAD_PROCESS_SHARED = 1,
/*
* pthread_barrier_wait
@@ -584,13 +595,13 @@ enum {
* ====================
* ====================
*/
-#define PTHREAD_ONCE_INIT { PTW32_FALSE, -1 }
+#define PTHREAD_ONCE_INIT { PTW32_FALSE, -1 }
struct pthread_once_t_
{
- int done; /* indicates if user function executed */
- long started; /* First thread to increment this value */
- /* to zero executes the user function */
+ int done; /* indicates if user function executed */
+ long started; /* First thread to increment this value */
+ /* to zero executes the user function */
};
@@ -668,7 +679,17 @@ enum
#endif
typedef struct ptw32_cleanup_t ptw32_cleanup_t;
-typedef void (__cdecl *ptw32_cleanup_callback_t)(void *);
+
+#if defined(_MSC_VER)
+/* Disable MSVC 'anachronism used' warning */
+#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
{
@@ -678,125 +699,125 @@ struct ptw32_cleanup_t
};
#ifdef __CLEANUP_SEH
- /*
- * WIN32 SEH version of cancel cleanup.
- */
+ /*
+ * WIN32 SEH version of cancel cleanup.
+ */
#define pthread_cleanup_push( _rout, _arg ) \
- { \
- ptw32_cleanup_t _cleanup; \
- \
- _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \
- _cleanup.arg = (_arg); \
- __try \
- { \
+ { \
+ 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 ); \
- } \
- } \
- }
+ } \
+ __finally \
+ { \
+ if( _execute || AbnormalTermination()) \
+ { \
+ (*(_cleanup.routine))( _cleanup.arg ); \
+ } \
+ } \
+ }
#else /* __CLEANUP_SEH */
#ifdef __CLEANUP_C
- /*
- * C implementation of PThreads cancel cleanup
- */
+ /*
+ * C implementation of PThreads cancel cleanup
+ */
#define pthread_cleanup_push( _rout, _arg ) \
- { \
- ptw32_cleanup_t _cleanup; \
- \
- ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_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 ); \
- }
+ (void) ptw32_pop_cleanup( _execute ); \
+ }
#else /* __CLEANUP_C */
#ifdef __CLEANUP_CXX
- /*
- * C++ version of cancel cleanup.
- * - John E. Bossom.
- */
-
- class PThreadCleanup {
- /*
- * PThreadCleanup
- *
- * Purpose
- * This class is a C++ helper class that is
- * used to implement pthread_cleanup_push/
- * pthread_cleanup_pop.
- * The destructor of this class automatically
- * pops the pushed cleanup routine regardless
- * of how the code exits the scope
- * (i.e. such as by an exception)
- */
+ /*
+ * C++ version of cancel cleanup.
+ * - John E. Bossom.
+ */
+
+ class PThreadCleanup {
+ /*
+ * PThreadCleanup
+ *
+ * Purpose
+ * This class is a C++ helper class that is
+ * used to implement pthread_cleanup_push/
+ * pthread_cleanup_pop.
+ * The destructor of this class automatically
+ * pops the pushed cleanup routine regardless
+ * of how the code exits the scope
+ * (i.e. such as by an exception)
+ */
ptw32_cleanup_callback_t cleanUpRout;
- void * obj;
- int executeIt;
-
- public:
- PThreadCleanup() :
- cleanUpRout( 0 ),
- obj( 0 ),
- executeIt( 0 )
- /*
- * No cleanup performed
- */
- {
- }
-
- PThreadCleanup(
- ptw32_cleanup_callback_t routine,
- void * arg ) :
- cleanUpRout( routine ),
- obj( arg ),
- executeIt( 1 )
- /*
- * Registers a cleanup routine for 'arg'
- */
- {
- }
-
- ~PThreadCleanup()
- {
- if ( executeIt && ((void *) cleanUpRout != (void *) 0) )
- {
- (void) (*cleanUpRout)( obj );
- }
- }
-
- void execute( int exec )
- {
- executeIt = exec;
- }
- };
-
- /*
- * C++ implementation of PThreads cancel cleanup;
- * This implementation takes advantage of a helper
- * class who's destructor automatically calls the
- * cleanup routine if we exit our scope weirdly
- */
+ void * obj;
+ int executeIt;
+
+ public:
+ PThreadCleanup() :
+ cleanUpRout( 0 ),
+ obj( 0 ),
+ executeIt( 0 )
+ /*
+ * No cleanup performed
+ */
+ {
+ }
+
+ PThreadCleanup(
+ ptw32_cleanup_callback_t routine,
+ void * arg ) :
+ cleanUpRout( routine ),
+ obj( arg ),
+ executeIt( 1 )
+ /*
+ * Registers a cleanup routine for 'arg'
+ */
+ {
+ }
+
+ ~PThreadCleanup()
+ {
+ if ( executeIt && ((void *) cleanUpRout != (void *) 0) )
+ {
+ (void) (*cleanUpRout)( obj );
+ }
+ }
+
+ void execute( int exec )
+ {
+ executeIt = exec;
+ }
+ };
+
+ /*
+ * C++ implementation of PThreads cancel cleanup;
+ * This implementation takes advantage of a helper
+ * class who's destructor automatically calls the
+ * cleanup routine if we exit our scope weirdly
+ */
#define pthread_cleanup_push( _rout, _arg ) \
- { \
- PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \
- (void *) (_arg) );
+ { \
+ PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \
+ (void *) (_arg) );
#define pthread_cleanup_pop( _execute ) \
- cleanup.execute( _execute ); \
- }
+ cleanup.execute( _execute ); \
+ }
#else
@@ -819,259 +840,259 @@ struct ptw32_cleanup_t
/*
* PThread Attribute Functions
*/
-PTW32_DLLPORT int pthread_attr_init (pthread_attr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr);
-PTW32_DLLPORT int pthread_attr_destroy (pthread_attr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr);
-PTW32_DLLPORT int pthread_attr_getdetachstate (const pthread_attr_t * attr,
- int *detachstate);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr,
+ int *detachstate);
-PTW32_DLLPORT int pthread_attr_getstackaddr (const pthread_attr_t * attr,
- void **stackaddr);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr,
+ void **stackaddr);
-PTW32_DLLPORT int pthread_attr_getstacksize (const pthread_attr_t * attr,
- size_t * stacksize);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr,
+ size_t * stacksize);
-PTW32_DLLPORT int pthread_attr_setdetachstate (pthread_attr_t * attr,
- int detachstate);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr,
+ int detachstate);
-PTW32_DLLPORT int pthread_attr_setstackaddr (pthread_attr_t * attr,
- void *stackaddr);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr,
+ void *stackaddr);
-PTW32_DLLPORT int pthread_attr_setstacksize (pthread_attr_t * attr,
- size_t stacksize);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr,
+ size_t stacksize);
-PTW32_DLLPORT int pthread_attr_getschedparam (const pthread_attr_t *attr,
- struct sched_param *param);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr,
+ struct sched_param *param);
-PTW32_DLLPORT int pthread_attr_setschedparam (pthread_attr_t *attr,
- const struct sched_param *param);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr,
+ const struct sched_param *param);
-PTW32_DLLPORT int pthread_attr_setschedpolicy (pthread_attr_t *,
- int);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *,
+ int);
-PTW32_DLLPORT int pthread_attr_getschedpolicy (pthread_attr_t *,
- int *);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (pthread_attr_t *,
+ int *);
-PTW32_DLLPORT int pthread_attr_setinheritsched(pthread_attr_t * attr,
- int inheritsched);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr,
+ int inheritsched);
-PTW32_DLLPORT int pthread_attr_getinheritsched(pthread_attr_t * attr,
- int * inheritsched);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(pthread_attr_t * attr,
+ int * inheritsched);
-PTW32_DLLPORT int pthread_attr_setscope (pthread_attr_t *,
- int);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *,
+ int);
-PTW32_DLLPORT int pthread_attr_getscope (const pthread_attr_t *,
- int *);
+PTW32_DLLPORT int PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *,
+ int *);
/*
* PThread Functions
*/
-PTW32_DLLPORT int pthread_create (pthread_t * tid,
- const pthread_attr_t * attr,
- void *(*start) (void *),
- void *arg);
+PTW32_DLLPORT int PTW32_CDECL pthread_create (pthread_t * tid,
+ const pthread_attr_t * attr,
+ void *(*start) (void *),
+ void *arg);
-PTW32_DLLPORT int pthread_detach (pthread_t tid);
+PTW32_DLLPORT int PTW32_CDECL pthread_detach (pthread_t tid);
-PTW32_DLLPORT int pthread_equal (pthread_t t1,
- pthread_t t2);
+PTW32_DLLPORT int PTW32_CDECL pthread_equal (pthread_t t1,
+ pthread_t t2);
-PTW32_DLLPORT void pthread_exit (void *value_ptr);
+PTW32_DLLPORT void PTW32_CDECL pthread_exit (void *value_ptr);
-PTW32_DLLPORT int pthread_join (pthread_t thread,
- void **value_ptr);
+PTW32_DLLPORT int PTW32_CDECL pthread_join (pthread_t thread,
+ void **value_ptr);
-PTW32_DLLPORT pthread_t pthread_self (void);
+PTW32_DLLPORT pthread_t PTW32_CDECL pthread_self (void);
-PTW32_DLLPORT int pthread_cancel (pthread_t thread);
+PTW32_DLLPORT int PTW32_CDECL pthread_cancel (pthread_t thread);
-PTW32_DLLPORT int pthread_setcancelstate (int state,
- int *oldstate);
+PTW32_DLLPORT int PTW32_CDECL pthread_setcancelstate (int state,
+ int *oldstate);
-PTW32_DLLPORT int pthread_setcanceltype (int type,
- int *oldtype);
+PTW32_DLLPORT int PTW32_CDECL pthread_setcanceltype (int type,
+ int *oldtype);
-PTW32_DLLPORT void pthread_testcancel (void);
+PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void);
-PTW32_DLLPORT int pthread_once (pthread_once_t * once_control,
- void (*init_routine) (void));
+PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control,
+ void (*init_routine) (void));
#if PTW32_LEVEL >= PTW32_LEVEL_MAX
-PTW32_DLLPORT ptw32_cleanup_t *ptw32_pop_cleanup (int execute);
+PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute);
-PTW32_DLLPORT void ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
- void (*routine) (void *),
- void *arg);
+PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup,
+ void (*routine) (void *),
+ void *arg);
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
/*
* Thread Specific Data Functions
*/
-PTW32_DLLPORT int pthread_key_create (pthread_key_t * key,
- void (*destructor) (void *));
+PTW32_DLLPORT int PTW32_CDECL pthread_key_create (pthread_key_t * key,
+ void (*destructor) (void *));
-PTW32_DLLPORT int pthread_key_delete (pthread_key_t key);
+PTW32_DLLPORT int PTW32_CDECL pthread_key_delete (pthread_key_t key);
-PTW32_DLLPORT int pthread_setspecific (pthread_key_t key,
- const void *value);
+PTW32_DLLPORT int PTW32_CDECL pthread_setspecific (pthread_key_t key,
+ const void *value);
-PTW32_DLLPORT void *pthread_getspecific (pthread_key_t key);
+PTW32_DLLPORT void * PTW32_CDECL pthread_getspecific (pthread_key_t key);
/*
* Mutex Attribute Functions
*/
-PTW32_DLLPORT int pthread_mutexattr_init (pthread_mutexattr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr);
-PTW32_DLLPORT int pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr);
-PTW32_DLLPORT int pthread_mutexattr_getpshared (const pthread_mutexattr_t
- * attr,
- int *pshared);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t
+ * attr,
+ int *pshared);
-PTW32_DLLPORT int pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
- int pshared);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr,
+ int pshared);
-PTW32_DLLPORT int pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
-PTW32_DLLPORT int pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind);
/*
* Barrier Attribute Functions
*/
-PTW32_DLLPORT int pthread_barrierattr_init (pthread_barrierattr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr);
-PTW32_DLLPORT int pthread_barrierattr_destroy (pthread_barrierattr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr);
-PTW32_DLLPORT int pthread_barrierattr_getpshared (const pthread_barrierattr_t
- * attr,
- int *pshared);
+PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t
+ * attr,
+ int *pshared);
-PTW32_DLLPORT int pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
- int pshared);
+PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr,
+ int pshared);
/*
* Mutex Functions
*/
-PTW32_DLLPORT int pthread_mutex_init (pthread_mutex_t * mutex,
- const pthread_mutexattr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex,
+ const pthread_mutexattr_t * attr);
-PTW32_DLLPORT int pthread_mutex_destroy (pthread_mutex_t * mutex);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex);
-PTW32_DLLPORT int pthread_mutex_lock (pthread_mutex_t * mutex);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex);
-PTW32_DLLPORT int pthread_mutex_timedlock(pthread_mutex_t *mutex,
- const struct timespec *abstime);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t *mutex,
+ const struct timespec *abstime);
-PTW32_DLLPORT int pthread_mutex_trylock (pthread_mutex_t * mutex);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex);
-PTW32_DLLPORT int pthread_mutex_unlock (pthread_mutex_t * mutex);
+PTW32_DLLPORT int PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex);
/*
* Spinlock Functions
*/
-PTW32_DLLPORT int pthread_spin_init (pthread_spinlock_t * lock, int pshared);
+PTW32_DLLPORT int PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared);
-PTW32_DLLPORT int pthread_spin_destroy (pthread_spinlock_t * lock);
+PTW32_DLLPORT int PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock);
-PTW32_DLLPORT int pthread_spin_lock (pthread_spinlock_t * lock);
+PTW32_DLLPORT int PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock);
-PTW32_DLLPORT int pthread_spin_trylock (pthread_spinlock_t * lock);
+PTW32_DLLPORT int PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock);
-PTW32_DLLPORT int pthread_spin_unlock (pthread_spinlock_t * lock);
+PTW32_DLLPORT int PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock);
/*
* Barrier Functions
*/
-PTW32_DLLPORT int pthread_barrier_init (pthread_barrier_t * barrier,
- const pthread_barrierattr_t * attr,
- unsigned int count);
+PTW32_DLLPORT int PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier,
+ const pthread_barrierattr_t * attr,
+ unsigned int count);
-PTW32_DLLPORT int pthread_barrier_destroy (pthread_barrier_t * barrier);
+PTW32_DLLPORT int PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier);
-PTW32_DLLPORT int pthread_barrier_wait (pthread_barrier_t * barrier);
+PTW32_DLLPORT int PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier);
/*
* Condition Variable Attribute Functions
*/
-PTW32_DLLPORT int pthread_condattr_init (pthread_condattr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr);
-PTW32_DLLPORT int pthread_condattr_destroy (pthread_condattr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr);
-PTW32_DLLPORT int pthread_condattr_getpshared (const pthread_condattr_t * attr,
- int *pshared);
+PTW32_DLLPORT int PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr,
+ int *pshared);
-PTW32_DLLPORT int pthread_condattr_setpshared (pthread_condattr_t * attr,
- int pshared);
+PTW32_DLLPORT int PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr,
+ int pshared);
/*
* Condition Variable Functions
*/
-PTW32_DLLPORT int pthread_cond_init (pthread_cond_t * cond,
- const pthread_condattr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_init (pthread_cond_t * cond,
+ const pthread_condattr_t * attr);
-PTW32_DLLPORT int pthread_cond_destroy (pthread_cond_t * cond);
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond);
-PTW32_DLLPORT int pthread_cond_wait (pthread_cond_t * cond,
- pthread_mutex_t * mutex);
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex);
-PTW32_DLLPORT int pthread_cond_timedwait (pthread_cond_t * cond,
- pthread_mutex_t * mutex,
- const struct timespec *abstime);
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond,
+ pthread_mutex_t * mutex,
+ const struct timespec *abstime);
-PTW32_DLLPORT int pthread_cond_signal (pthread_cond_t * cond);
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond);
-PTW32_DLLPORT int pthread_cond_broadcast (pthread_cond_t * cond);
+PTW32_DLLPORT int PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond);
/*
* Scheduling
*/
-PTW32_DLLPORT int pthread_setschedparam (pthread_t thread,
- int policy,
- const struct sched_param *param);
+PTW32_DLLPORT int PTW32_CDECL pthread_setschedparam (pthread_t thread,
+ int policy,
+ const struct sched_param *param);
-PTW32_DLLPORT int pthread_getschedparam (pthread_t thread,
- int *policy,
- struct sched_param *param);
+PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread,
+ int *policy,
+ struct sched_param *param);
-PTW32_DLLPORT int pthread_setconcurrency (int);
+PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int);
-PTW32_DLLPORT int pthread_getconcurrency (void);
+PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void);
/*
* Read-Write Lock Functions
*/
-PTW32_DLLPORT int pthread_rwlock_init(pthread_rwlock_t *lock,
- const pthread_rwlockattr_t *attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock,
+ const pthread_rwlockattr_t *attr);
-PTW32_DLLPORT int pthread_rwlock_destroy(pthread_rwlock_t *lock);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock);
-PTW32_DLLPORT int pthread_rwlock_tryrdlock(pthread_rwlock_t *);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *);
-PTW32_DLLPORT int pthread_rwlock_trywrlock(pthread_rwlock_t *);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *);
-PTW32_DLLPORT int pthread_rwlock_rdlock(pthread_rwlock_t *lock);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock);
-PTW32_DLLPORT int pthread_rwlock_timedrdlock(pthread_rwlock_t *lock,
- const struct timespec *abstime);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock,
+ const struct timespec *abstime);
-PTW32_DLLPORT int pthread_rwlock_wrlock(pthread_rwlock_t *lock);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock);
-PTW32_DLLPORT int pthread_rwlock_timedwrlock(pthread_rwlock_t *lock,
- const struct timespec *abstime);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock,
+ const struct timespec *abstime);
-PTW32_DLLPORT int pthread_rwlock_unlock(pthread_rwlock_t *lock);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock);
-PTW32_DLLPORT int pthread_rwlockattr_init (pthread_rwlockattr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr);
-PTW32_DLLPORT int pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr);
-PTW32_DLLPORT int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr,
- int *pshared);
+PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr,
+ int *pshared);
-PTW32_DLLPORT int pthread_rwlockattr_setpshared (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
@@ -1079,7 +1100,7 @@ PTW32_DLLPORT int pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr,
* Signal Functions. Should be defined in <signal.h> but MSVC and MinGW32
* already have signal.h that don't define these.
*/
-PTW32_DLLPORT int pthread_kill(pthread_t thread, int sig);
+PTW32_DLLPORT int PTW32_CDECL pthread_kill(pthread_t thread, int sig);
/*
* Non-portable functions
@@ -1088,25 +1109,25 @@ PTW32_DLLPORT int pthread_kill(pthread_t thread, int sig);
/*
* Compatibility with Linux.
*/
-PTW32_DLLPORT int pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr,
- int kind);
-PTW32_DLLPORT int pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr,
- int *kind);
+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);
/*
* Possibly supported by other POSIX threads implementations
*/
-PTW32_DLLPORT int pthread_delay_np (struct timespec * interval);
-PTW32_DLLPORT int pthread_num_processors_np(void);
+PTW32_DLLPORT int PTW32_CDECL pthread_delay_np (struct timespec * interval);
+PTW32_DLLPORT int PTW32_CDECL pthread_num_processors_np(void);
/*
* Useful if an application wants to statically link
* the lib rather than load the DLL at run-time.
*/
-PTW32_DLLPORT int pthread_win32_process_attach_np(void);
-PTW32_DLLPORT int pthread_win32_process_detach_np(void);
-PTW32_DLLPORT int pthread_win32_thread_attach_np(void);
-PTW32_DLLPORT int pthread_win32_thread_detach_np(void);
+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);
/*
* Register a system time change with the library.
@@ -1116,7 +1137,7 @@ PTW32_DLLPORT int pthread_win32_thread_detach_np(void);
* WM_TIMECHANGE message. It can be passed directly to
* pthread_create() as a new thread if desired.
*/
-PTW32_DLLPORT void * pthread_timechange_handler_np(void *);
+PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *);
#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */
@@ -1125,7 +1146,7 @@ PTW32_DLLPORT void * pthread_timechange_handler_np(void *);
/*
* Returns the Win32 HANDLE for the POSIX thread.
*/
-PTW32_DLLPORT HANDLE pthread_getw32threadhandle_np(pthread_t thread);
+PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread);
/*
@@ -1136,16 +1157,16 @@ PTW32_DLLPORT HANDLE pthread_getw32threadhandle_np(pthread_t thread);
* This function allows the caller to hook into the
* PThreads cancel mechanism. It is implemented using
*
- * WaitForMultipleObjects
+ * WaitForMultipleObjects
*
* on 'waitHandle' and a manually reset WIN32 Event
* used to implement pthread_cancel. The 'timeout'
* argument to TimedWait is simply passed to
* WaitForMultipleObjects.
*/
-PTW32_DLLPORT int pthreadCancelableWait (HANDLE waitHandle);
-PTW32_DLLPORT int pthreadCancelableTimedWait (HANDLE waitHandle,
- DWORD timeout);
+PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle);
+PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle,
+ DWORD timeout);
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
@@ -1154,12 +1175,12 @@ PTW32_DLLPORT int pthreadCancelableTimedWait (HANDLE waitHandle,
*/
#ifndef _UWIN
# if defined(NEED_ERRNO)
- PTW32_DLLPORT int * _errno( void );
+ PTW32_DLLPORT int * PTW32_CDECL _errno( void );
# else
# ifndef errno
# if (defined(_MT) || defined(_DLL))
- __declspec(dllimport) extern int * __cdecl _errno(void);
-# define errno (*_errno())
+ __declspec(dllimport) extern int * __cdecl _errno(void);
+# define errno (*_errno())
# endif
# endif
# endif
@@ -1176,27 +1197,27 @@ PTW32_DLLPORT int pthreadCancelableTimedWait (HANDLE waitHandle,
#if !defined(__MINGW32__)
#define strtok_r( _s, _sep, _lasts ) \
- ( *(_lasts) = strtok( (_s), (_sep) ) )
+ ( *(_lasts) = strtok( (_s), (_sep) ) )
#endif /* !__MINGW32__ */
#define asctime_r( _tm, _buf ) \
- ( strcpy( (_buf), asctime( (_tm) ) ), \
- (_buf) )
+ ( strcpy( (_buf), asctime( (_tm) ) ), \
+ (_buf) )
#define ctime_r( _clock, _buf ) \
- ( strcpy( (_buf), ctime( (_clock) ) ), \
- (_buf) )
+ ( strcpy( (_buf), ctime( (_clock) ) ), \
+ (_buf) )
#define gmtime_r( _clock, _result ) \
- ( *(_result) = *gmtime( (_clock) ), \
- (_result) )
+ ( *(_result) = *gmtime( (_clock) ), \
+ (_result) )
#define localtime_r( _clock, _result ) \
- ( *(_result) = *localtime( (_clock) ), \
- (_result) )
+ ( *(_result) = *localtime( (_clock) ), \
+ (_result) )
#define rand_r( _seed ) \
- ( _seed == _seed? rand() : rand() )
+ ( _seed == _seed? rand() : rand() )
#ifdef __cplusplus
@@ -1216,7 +1237,7 @@ class ptw32_exception_exit : public ptw32_exception {};
/*
* Get internal SEH tag
*/
-PTW32_DLLPORT DWORD ptw32_get_exception_services_code(void);
+PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void);
#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */
@@ -1229,8 +1250,8 @@ PTW32_DLLPORT DWORD ptw32_get_exception_services_code(void);
* propagate our internal exceptions up to the library's internal handlers.
*/
#define __except( E ) \
- __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \
- ? EXCEPTION_CONTINUE_SEARCH : ( E ) )
+ __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \
+ ? EXCEPTION_CONTINUE_SEARCH : ( E ) )
#endif /* __CLEANUP_SEH */
@@ -1241,10 +1262,10 @@ PTW32_DLLPORT DWORD ptw32_get_exception_services_code(void);
* propagate our internal exceptions up to the library's internal handlers.
*/
#ifdef _MSC_VER
- /*
- * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll'
- * if you want Pthread-Win32 cancelation and pthread_exit to work.
- */
+ /*
+ * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll'
+ * if you want Pthread-Win32 cancelation and pthread_exit to work.
+ */
#ifndef PtW32NoCatchWarn
@@ -1260,22 +1281,22 @@ PTW32_DLLPORT DWORD ptw32_get_exception_services_code(void);
#pragma message(" #else")
#pragma message(" catch(...)")
#pragma message(" #endif")
-#pragma message(" {")
-#pragma message(" /* Catchall block processing */")
-#pragma message(" }")
+#pragma message(" {")
+#pragma message(" /* Catchall block processing */")
+#pragma message(" }")
#pragma message("------------------------------------------------------------------")
#endif
#define PtW32CatchAll \
- catch( ptw32_exception & ) { throw; } \
- catch( ... )
+ catch( ptw32_exception & ) { throw; } \
+ catch( ... )
#else /* _MSC_VER */
#define catch( E ) \
- catch( ptw32_exception & ) { throw; } \
- catch( E )
+ catch( ptw32_exception & ) { throw; } \
+ catch( E )
#endif /* _MSC_VER */
@@ -1284,8 +1305,8 @@ PTW32_DLLPORT DWORD ptw32_get_exception_services_code(void);
#endif /* ! PTW32_BUILD */
#ifdef __cplusplus
-} /* End of extern "C" */
-#endif /* __cplusplus */
+} /* End of extern "C" */
+#endif /* __cplusplus */
#ifdef PTW32__HANDLE_DEF
# undef HANDLE