diff options
author | rpj <rpj> | 1999-02-12 08:19:34 +0000 |
---|---|---|
committer | rpj <rpj> | 1999-02-12 08:19:34 +0000 |
commit | 44f6c8a35ca491b1f04d6b460ab5d0d8a3cf6083 (patch) | |
tree | 43343d58f15346fea6d09371c7d6abb090fa8842 /pthread.h | |
parent | eb222bd25ddfc39ac156d59331f1dd4c3ef5df9b (diff) |
Sat Feb 13 03:03:30 1999 Ross Johnson <rpj@ixobrychus.canberra.edu.au>
* pthread.h (struct pthread_once_t_): Replaced.
* misc.c (pthread_once): Replace with John Bossom's version;
has lighter weight serialisation; fixes problem of not holding
competing threads until after the init_routine completes.
Diffstat (limited to 'pthread.h')
-rw-r--r-- | pthread.h | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -491,8 +491,14 @@ extern "C" * ==================== * ==================== */ -#define PTHREAD_ONCE_INIT { 0, PTHREAD_MUTEX_INITIALIZER } +#define PTHREAD_ONCE_INIT { 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 */ +}; /* * ==================== |