From 44f6c8a35ca491b1f04d6b460ab5d0d8a3cf6083 Mon Sep 17 00:00:00 2001 From: rpj Date: Fri, 12 Feb 1999 08:19:34 +0000 Subject: Sat Feb 13 03:03:30 1999 Ross Johnson * 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. --- pthread.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pthread.h') diff --git a/pthread.h b/pthread.h index 415602c..d08eac3 100644 --- a/pthread.h +++ b/pthread.h @@ -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 */ +}; /* * ==================== -- cgit v1.2.3