diff options
-rw-r--r-- | libc/inet/rpc/rpc_thread.c | 40 | ||||
-rw-r--r-- | libpthread/linuxthreads/mutex.c | 4 |
2 files changed, 22 insertions, 22 deletions
diff --git a/libc/inet/rpc/rpc_thread.c b/libc/inet/rpc/rpc_thread.c index 90b0a6a2a..6c01af95c 100644 --- a/libc/inet/rpc/rpc_thread.c +++ b/libc/inet/rpc/rpc_thread.c @@ -12,25 +12,6 @@ static struct rpc_thread_variables __libc_tsd_RPC_VARS_mem; static struct rpc_thread_variables *__libc_tsd_RPC_VARS_data = &__libc_tsd_RPC_VARS_mem; -extern int __pthread_once (pthread_once_t *__once_control, - void (*__init_routine) (void)); -asm (".weak __pthread_once"); - - -# define __libc_once_define(CLASS, NAME) \ - CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT - -/* Call handler iff the first call. */ -#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ - do { \ - if (__pthread_once != NULL) \ - __pthread_once (&(ONCE_CONTROL), (INIT_FUNCTION)); \ - else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ - INIT_FUNCTION (); \ - (ONCE_CONTROL) = !PTHREAD_ONCE_INIT; \ - } \ - } while (0) - /* * Task-variable destructor */ @@ -54,8 +35,27 @@ __rpc_thread_destroy (void) } -#if 0 #warning fix multithreaded initialization... +#if 0 +extern int __pthread_once (pthread_once_t *__once_control, + void (*__init_routine) (void)); +asm (".weak __pthread_once"); + + +# define __libc_once_define(CLASS, NAME) \ + CLASS pthread_once_t NAME = PTHREAD_ONCE_INIT + +/* Call handler iff the first call. */ +#define __libc_once(ONCE_CONTROL, INIT_FUNCTION) \ + do { \ + if (__pthread_once != NULL) \ + __pthread_once (&(ONCE_CONTROL), (INIT_FUNCTION)); \ + else if ((ONCE_CONTROL) == PTHREAD_ONCE_INIT) { \ + INIT_FUNCTION (); \ + (ONCE_CONTROL) = !PTHREAD_ONCE_INIT; \ + } \ + } while (0) + /* * Initialize RPC multi-threaded operation */ diff --git a/libpthread/linuxthreads/mutex.c b/libpthread/linuxthreads/mutex.c index 2caf8f8ed..2ab9e7e55 100644 --- a/libpthread/linuxthreads/mutex.c +++ b/libpthread/linuxthreads/mutex.c @@ -195,7 +195,7 @@ static pthread_cond_t once_finished = PTHREAD_COND_INITIALIZER; enum { NEVER = 0, IN_PROGRESS = 1, DONE = 2 }; -int pthread_once(pthread_once_t * once_control, void (*init_routine)(void)) +int __pthread_once(pthread_once_t * once_control, void (*init_routine)(void)) { /* Test without locking first for speed */ if (*once_control == DONE) return 0; @@ -218,4 +218,4 @@ int pthread_once(pthread_once_t * once_control, void (*init_routine)(void)) pthread_mutex_unlock(&once_masterlock); return 0; } -//strong_alias (__pthread_once, pthread_once) +strong_alias (__pthread_once, pthread_once) |