summaryrefslogtreecommitdiff
path: root/implement.h
diff options
context:
space:
mode:
authorrpj <rpj>2001-07-05 11:57:32 +0000
committerrpj <rpj>2001-07-05 11:57:32 +0000
commit99e8ecc5759668fd3af379eaddd70b4ae50ecd7f (patch)
tree8b824cc1eb8de6fd15a4b5636f5f62fa95541105 /implement.h
parent861a8bb5523f257b474f68334c2c5300e52c5371 (diff)
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.
Diffstat (limited to 'implement.h')
-rw-r--r--implement.h20
1 files changed, 19 insertions, 1 deletions
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;