From 0830eed6a52cc9386913075dcc5b00de2596624b Mon Sep 17 00:00:00 2001 From: rpj Date: Sat, 25 Jul 1998 15:19:39 +0000 Subject: Sun Jul 26 00:09:59 1998 Ross Johnson * pthread.h: Converting PTHREAD_* defines to alias the (const int) values in global.c. * global.c: Started converting PTHREAD_* defines to (const int) as a part of making the eventual pthreads DLL binary compatible through version changes. --- ChangeLog | 7 +++++++ global.c | 23 +++++++++++++++++++++++ pthread.h | 30 ++++++++++++++++++++---------- 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2cc4154..1d2affd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ Sun Jul 26 00:09:59 1998 Ross Johnson + * pthread.h: Converting PTHREAD_* defines to alias the (const int) + values in global.c. + + * global.c: Started converting PTHREAD_* defines to (const int) as + a part of making the eventual pthreads DLL binary compatible + through version changes. + * condvar.c (cond_wait): Add cancelation point. This applies the point to both pthread_cond_wait() and pthread_cond_timedwait(). diff --git a/global.c b/global.c index cbc300d..406d203 100644 --- a/global.c +++ b/global.c @@ -11,6 +11,29 @@ #include "pthread.h" #include "implement.h" +#define PTHREAD_THREADS_MAX 128 +#define PTHREAD_STACK_MIN 65535 + +/* Convert these to defined when implemented. */ +#define _POSIX_THREAD_ATTR_STACKSIZE +#ifdef _POSIX_THREAD_ATTR_STACKADDR +#undef _POSIX_THREAD_ATTR_STACKADDR +#endif + +/* Making these constants will mean that applications remain binary + compatible between versions of the DLL. */ + +const int _pthread_create_joinable = 0; +const int _pthread_create_detached = 1; + +/* Cancelability attributes */ +const int _pthread_cancel_enable = 0; +const int _pthread_cancel_disable = 1; + +const int _pthread_cancel_asynchronous = 0; +const int _pthread_cancel_deferred = 1; + + pthread_mutex_t _pthread_count_mutex = PTHREAD_MUTEX_INITIALIZER; DWORD _pthread_threads_count = 0; diff --git a/pthread.h b/pthread.h index cce502a..7315bf0 100644 --- a/pthread.h +++ b/pthread.h @@ -60,16 +60,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define SCHED_MIN SCHED_OTHER #define SCHED_MAX SCHED_RR -#define PTHREAD_CREATE_JOINABLE 0 -#define PTHREAD_CREATE_DETACHED 1 - -/* Cancelability attributes */ -#define PTHREAD_CANCEL_ENABLE 0 -#define PTHREAD_CANCEL_DISABLE 1 - -#define PTHREAD_CANCEL_ASYNCHRONOUS 0 -#define PTHREAD_CANCEL_DEFERRED 1 - /* Cancelation return value. This value must be neither NULL nor the value of any pointer to an object in memory. */ @@ -282,6 +272,26 @@ int pthread_cancel(pthread_t thread); } #endif /* __cplusplus */ +extern const int _pthread_create_joinable; +extern const int _pthread_create_detached; + +/* Cancelability attributes */ +extern const int _pthread_cancel_enable; +extern const int _pthread_cancel_disable; + +extern const int _pthread_cancel_asynchronous; +extern const int _pthread_cancel_deferred; + +#define PTHREAD_CREATE_JOINABLE _pthread_create_joinable +#define PTHREAD_CREATE_DETACHED _pthread_create_detached + +/* Cancelability attributes */ +#define PTHREAD_CANCEL_ENABLE _pthread_cancel_enable +#define PTHREAD_CANCEL_DISABLE _pthread_cancel_disable + +#define PTHREAD_CANCEL_ASYNCHRONOUS _pthread_cancel_asynchronous +#define PTHREAD_CANCEL_DEFERRED _pthread_cancel_deferred + /* The following #defines implement POSIX cleanup handlers. The standard requires that these functions be used as statements and -- cgit v1.2.3