summaryrefslogtreecommitdiff
path: root/pthread.h
diff options
context:
space:
mode:
authorrpj <rpj>1999-02-02 02:01:56 +0000
committerrpj <rpj>1999-02-02 02:01:56 +0000
commitcc29ad943903e9b8dba96cd978cb126f79f73e38 (patch)
tree17a310f2fb26c829acbecf498453531637bf863c /pthread.h
parent6237335fec273ac2b00c32609a8eef91c6ec7473 (diff)
Mods to compile under Mingw32 egcs.
Tue Feb 2 18:07:43 1999 Ross Johnson <rpj@swan.canberra.edu.au> * implement.h: Add #include <pthread.h>. Change sem_t to _pthread_sem_t. Various patches by Kevin Ruland <Kevin.Ruland@anheuser-busch.com> * signal.c (pthread_sigmask): Add and modify casts. Reverse LHS/RHS bitwise assignments. * pthread.h: Remove #include <semaphore.h>. (_PTHREAD_ATTR_VALID): Add cast. (struct pthread_t_): Add sigmask element. * dll.c: Add "extern C" for DLLMain. (DllMain): Add cast. * create.c (pthread_create): Set sigmask in thread. * condvar.c: Remove #include. Change sem_* to _pthread_sem_*. * attr.c: Changed #include. * Makefile.in: Additional targets and changes to build the library as a DLL. Fri Jan 29 11:56:28 1999 Ross Johnson <rpj@swan.canberra.edu.au> * Makefile.in (OBJS): Add semaphore.o to list. * semaphore.c (_pthread_sem_timedwait): Move from private.c. Rename sem_* to _pthread_sem_*. * pthread.h (pthread_cond_t): Change type of sem_t. _POSIX_SEMAPHORES no longer defined. * semaphore.h: Contents moved to implement.h. Removed from source tree. * implement.h: Add semaphore function prototypes and ename all functions to prepend '_pthread_'. They are now private to the pthreads-win32 implementation. * private.c: Change #warning. Move _pthread_sem_timedwait() to semaphore.c. * cleanup.c: Change #warning. * misc.c: Remove #include <errno.h> * pthread.def: Cleanup CVS merge conflicts. * global.c: Ditto. * ChangeLog: Ditto. * cleanup.c: Ditto.
Diffstat (limited to 'pthread.h')
-rw-r--r--pthread.h58
1 files changed, 23 insertions, 35 deletions
diff --git a/pthread.h b/pthread.h
index d090e43..e0fc11f 100644
--- a/pthread.h
+++ b/pthread.h
@@ -15,6 +15,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#if !defined( PTHREAD_H )
+#define PTHREAD_H
+
/*
* -------------------------------------------------------------
*
@@ -171,8 +174,6 @@
*
* -------------------------------------------------------------
*/
-#if !defined( PTHREAD_H )
-#define PTHREAD_H
#ifdef _MSC_VER
/*
@@ -249,7 +250,6 @@ struct timespec {
#endif /* !TRUE */
-#include <semaphore.h>
/* #include <sched.h> */
#ifdef __MINGW32__
@@ -278,16 +278,6 @@ extern "C"
* POSIX 1003.1c-1995 Options
* ===========================
*
- * _POSIX_SEMAPHORES
- * Semaphores come from POSIX.1b (POSIX 1003.1b-1993)
- * rather than from PThreads. This macro indicates
- * that POSIX Semaphores are supported:
- * sem_destroy
- * sem_init
- * sem_wait
- * sem_trywait
- * sem_post
- *
* _POSIX_THREADS (set)
* If set, you can use threads
*
@@ -381,7 +371,6 @@ extern "C"
* POSIX Options
*/
#define _POSIX_THREADS
-#define _POSIX_SEMAPHORES
#define _POSIX_THREAD_SAFE_FUNCTIONS
#define _POSIX_THREAD_ATTR_STACKSIZE
@@ -567,6 +556,9 @@ struct pthread_t_ {
int cancelState;
int cancelType;
HANDLE cancelEvent;
+#if HAVE_SIGSET_T
+ sigset_t sigmask;
+#endif /* HAVE_SIGSET_T */
int implicit:1;
void *keys;
};
@@ -575,7 +567,7 @@ struct pthread_t_ {
/*
* Special value to mark attribute objects as valid.
*/
-#define _PTHREAD_ATTR_VALID 0xC4C0FFEE
+#define _PTHREAD_ATTR_VALID ((unsigned long) 0xC4C0FFEE)
struct pthread_attr_t_ {
unsigned long valid;
@@ -611,11 +603,13 @@ struct pthread_key_t_ {
};
+typedef HANDLE _pthread_sem_t;
+
struct pthread_cond_t_ {
long waiters; /* # waiting threads */
pthread_mutex_t waitersLock; /* Mutex that guards access to
waiter count */
- sem_t sema; /* Queue up threads waiting for the
+ _pthread_sem_t sema; /* Queue up threads waiting for the
condition to become signaled */
HANDLE waitersDone; /* An auto reset event used by the
broadcast/signal thread to wait
@@ -668,19 +662,22 @@ struct pthread_once_t_ {
* C++
*/
+typedef struct _pthread_cleanup_t _pthread_cleanup_t;
+
+struct _pthread_cleanup_t
+{
+ void (*routine) (void *);
+ void *arg;
+#if !defined(_MSC_VER) && !defined(__cplusplus)
+ _pthread_cleanup_t *prev;
+#endif
+};
+
#ifdef _MSC_VER
/*
* WIN32 SEH version of cancel cleanup.
*/
- typedef struct _pthread_cleanup_t _pthread_cleanup_t;
-
- struct _pthread_cleanup_t
- {
- void (*routine) (void *);
- void *arg;
- };
-
#define pthread_cleanup_push( _rout, _arg ) \
{ \
_pthread_cleanup_t _cleanup; \
@@ -709,15 +706,6 @@ struct pthread_once_t_ {
* C implementation of PThreads cancel cleanup
*/
- typedef struct _pthread_cleanup_t _pthread_cleanup_t;
-
- struct _pthread_cleanup_t
- {
- void (*routine) (void *);
- void *arg;
- _pthread_cleanup_t *prev;
- };
-
#define pthread_cleanup_push( _rout, _arg ) \
{ \
_pthread_cleanup_t _cleanup; \
@@ -733,8 +721,6 @@ struct pthread_once_t_ {
/*
* C++ version of cancel cleanup.
* - John E. Bossom.
- *
- * Emulate try-finally behaviour.
*/
class PThreadCleanup {
@@ -1013,8 +999,10 @@ int pthreadCancelableTimedWait (HANDLE waitHandle, DWORD timeout);
* Only provide function mappings for functions that
* actually exist on WIN32.
*/
+#if !defined(__MINGW32__)
#define strtok_r( _s, _sep, _lasts ) \
( *(_lasts) = strtok( (_s), (_sep) ) )
+#endif /* !__MINGW32__ */
#define asctime_r( _tm, _buf ) \
( strcpy( (_buf), asctime( (_tm) ) ), \