diff options
author | Rich Felker <dalias@aerifal.cx> | 2011-04-03 12:08:34 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2011-04-03 12:08:34 -0400 |
commit | 6f1414e10297b75a58a92b678444fd277abc9a4f (patch) | |
tree | 2d013654908d7bcbced4036414c2c5890d50bad9 /src/time/timer_create.c | |
parent | f01d35184291c650f6a38f8b3da41693bfde0e70 (diff) | |
download | musl-6f1414e10297b75a58a92b678444fd277abc9a4f.tar.gz musl-6f1414e10297b75a58a92b678444fd277abc9a4f.tar.bz2 musl-6f1414e10297b75a58a92b678444fd277abc9a4f.tar.xz musl-6f1414e10297b75a58a92b678444fd277abc9a4f.zip |
revert to deleting kernel-level timer from cancellation handler
this is necessary in order to avoid breaking timer_getoverrun in the
last run of the timer event handler, if it has not yet finished.
Diffstat (limited to 'src/time/timer_create.c')
-rw-r--r-- | src/time/timer_create.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/time/timer_create.c b/src/time/timer_create.c index f02abb86..5d362c7e 100644 --- a/src/time/timer_create.c +++ b/src/time/timer_create.c @@ -24,6 +24,12 @@ void __sigtimer_handler(pthread_t self) pthread_setcancelstate(st, 0); } +static void cleanup(void *p) +{ + pthread_t self = p; + __syscall(SYS_timer_delete, self->result); +} + static void *start(void *arg) { pthread_t self = __pthread_self(); @@ -35,10 +41,12 @@ static void *start(void *arg) self->start_arg = args->sev->sigev_value.sival_ptr; self->result = (void *)-1; + pthread_cleanup_push(cleanup, self); pthread_barrier_wait(&args->b); pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0); /* Loop on async-signal-safe cancellation point */ for (;;) sleep(1); + pthread_cleanup_pop(0); return 0; } |