summaryrefslogtreecommitdiff
path: root/lib/libpthread/thread/thr_once.c
diff options
context:
space:
mode:
authorDaniel Eischen <deischen@FreeBSD.org>2003-04-18 05:04:16 +0000
committerDaniel Eischen <deischen@FreeBSD.org>2003-04-18 05:04:16 +0000
commita0240e2cb0b1ef8e5b61930ac2b850c884daaba8 (patch)
tree46bc1e113ddc7c1ed88e4fa724039df8664c963a /lib/libpthread/thread/thr_once.c
parentb025fc9a31c85b9cde9969e1fea55ea4caf650d5 (diff)
Notes
Diffstat (limited to 'lib/libpthread/thread/thr_once.c')
-rw-r--r--lib/libpthread/thread/thr_once.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libpthread/thread/thr_once.c b/lib/libpthread/thread/thr_once.c
index cef478d7dc48..152fdec7b407 100644
--- a/lib/libpthread/thread/thr_once.c
+++ b/lib/libpthread/thread/thr_once.c
@@ -31,23 +31,25 @@
*
* $FreeBSD$
*/
+#include "namespace.h"
#include <pthread.h>
+#include "un-namespace.h"
#include "thr_private.h"
__weak_reference(_pthread_once, pthread_once);
int
-_pthread_once(pthread_once_t * once_control, void (*init_routine) (void))
+_pthread_once(pthread_once_t *once_control, void (*init_routine) (void))
{
if (once_control->state == PTHREAD_NEEDS_INIT) {
- if (_thread_initial == NULL)
- _thread_init();
- pthread_mutex_lock(&(once_control->mutex));
+ if (_thr_initial == NULL)
+ _libpthread_init(NULL);
+ _pthread_mutex_lock(&(once_control->mutex));
if (once_control->state == PTHREAD_NEEDS_INIT) {
init_routine();
once_control->state = PTHREAD_DONE_INIT;
}
- pthread_mutex_unlock(&(once_control->mutex));
+ _pthread_mutex_unlock(&(once_control->mutex));
}
return (0);
}