1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- #include "pthreadP.h"
- #include <lowlevellock.h>
- static int once_lock = LLL_LOCK_INITIALIZER;
- int
- __pthread_once (
- pthread_once_t *once_control,
- void (*init_routine) (void))
- {
-
- if (*once_control == PTHREAD_ONCE_INIT)
- {
- lll_lock (once_lock, LLL_PRIVATE);
-
- if (*once_control == PTHREAD_ONCE_INIT)
- {
- init_routine ();
- *once_control = !PTHREAD_ONCE_INIT;
- }
- lll_unlock (once_lock, LLL_PRIVATE);
- }
- return 0;
- }
- strong_alias (__pthread_once, pthread_once)
|