diff options
Diffstat (limited to 'lib/libkse/thread/thr_once.c')
-rw-r--r-- | lib/libkse/thread/thr_once.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libkse/thread/thr_once.c b/lib/libkse/thread/thr_once.c index ad158d1..40344bd 100644 --- a/lib/libkse/thread/thr_once.c +++ b/lib/libkse/thread/thr_once.c @@ -67,6 +67,7 @@ once_cancel_handler(void *arg) int _pthread_once(pthread_once_t *once_control, void (*init_routine) (void)) { + struct pthread *curthread; int wakeup = 0; if (once_control->state == ONCE_DONE) @@ -81,9 +82,10 @@ _pthread_once(pthread_once_t *once_control, void (*init_routine) (void)) if (*(volatile int *)&(once_control->state) == ONCE_NEVER_DONE) { once_control->state = ONCE_IN_PROGRESS; _pthread_mutex_unlock(&once_lock); - _pthread_cleanup_push(once_cancel_handler, once_control); + curthread = _get_curthread(); + THR_CLEANUP_PUSH(curthread, once_cancel_handler, once_control); init_routine(); - _pthread_cleanup_pop(0); + THR_CLEANUP_POP(curthread, 0); _pthread_mutex_lock(&once_lock); once_control->state = ONCE_DONE; wakeup = 1; |