summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2007-10-16 07:46:15 +0000
committerdavidxu <davidxu@FreeBSD.org>2007-10-16 07:46:15 +0000
commit5523a9bb3425c9762eec5119c6b6f5399bf5917d (patch)
tree507570881d0af8b115c16c8bb5287bd0c42d3bff /lib
parent38b01da7d2b4c1df95f315ea9c8f9395570473dc (diff)
downloadFreeBSD-src-5523a9bb3425c9762eec5119c6b6f5399bf5917d.zip
FreeBSD-src-5523a9bb3425c9762eec5119c6b6f5399bf5917d.tar.gz
Use macro THR_CLEANUP_PUSH/POP, they are cheaper than pthread_cleanup_push/pop.
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/thread/thr_once.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libthr/thread/thr_once.c b/lib/libthr/thread/thr_once.c
index 4fe392c..bd1bed1 100644
--- a/lib/libthr/thread/thr_once.c
+++ b/lib/libthr/thread/thr_once.c
@@ -64,6 +64,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)
@@ -78,9 +79,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(&_thr_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(&_thr_once_lock);
once_control->state = ONCE_DONE;
wakeup = 1;
OpenPOWER on IntegriCloud