From 99e8ecc5759668fd3af379eaddd70b4ae50ecd7f Mon Sep 17 00:00:00 2001 From: rpj Date: Thu, 5 Jul 2001 11:57:32 +0000 Subject: Added new routines from POSIX 1003.1j. This is alpha level code. * spin.c: New module implementing spin locks. * barrier.c: New module implementing barriers. * pthread.h (_POSIX_SPIN_LOCKS): defined. (_POSIX_BARRIERS): Defined. (pthread_spin_*): Defined. (pthread_barrier*): Defined. (PTHREAD_BARRIER_SERIAL_THREAD): Defined. * implement.h (pthread_spinlock_t_): Defined. (pthread_barrier_t_): Defined. (pthread_barrierattr_t_): Defined. * mutex.c (pthread_mutex_lock): Return with the error if an auto-initialiser initialisation fails. * nonportable.c (pthread_getprocessors_np): New; gets the number of available processors for the current process. --- implement.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'implement.h') diff --git a/implement.h b/implement.h index e2acba3..34055dd 100644 --- a/implement.h +++ b/implement.h @@ -136,6 +136,8 @@ struct sem_t_ { #define PTW32_OBJECT_AUTO_INIT ((void *) -1) #define PTW32_OBJECT_INVALID NULL +#define PTW32_SPIN_UNLOCKED ((void *) 1) +#define PTW32_SPIN_LOCKED ((void *) 2) struct pthread_mutex_t_ { LONG lock_idx; @@ -146,12 +148,28 @@ struct pthread_mutex_t_ { CRITICAL_SECTION try_lock_cs; }; - struct pthread_mutexattr_t_ { int pshared; int kind; }; +struct pthread_spinlock_t_ { + union { + LONG interlock; + pthread_mutex_t mx; + } u; +}; + +struct pthread_barrier_t_ { + LONG nCurrentBarrierHeight; + LONG nInitialBarrierHeight; + sem_t semBarrierBreeched; + pthread_mutex_t mtxExclusiveAccess; +}; + +struct pthread_barrierattr_t_ { + int pshared; +}; struct pthread_key_t_ { DWORD key; -- cgit v1.2.3