Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int pthread_once(pthread_once_t *once_control, void (*init_routine)(void))
- {
- /* Check first for speed */
- if (once_control->state == PTHREAD_NEEDS_INIT) {
- 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));
- }
- return(OK);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement