about summary refs log tree commit diff
path: root/src/time/timer_create.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2013-08-03 17:10:42 -0400
committerRich Felker <dalias@aerifal.cx>2013-08-03 17:10:42 -0400
commita7f18a55298ffaa287336fd0c81dcd3fe45e16b6 (patch)
tree779ffd37a5da2dcb1c6fee92031ac554df56214c /src/time/timer_create.c
parent7c6c290695cb8726e876ff4fb8413913f661fc0b (diff)
downloadmusl-a7f18a55298ffaa287336fd0c81dcd3fe45e16b6.tar.gz
musl-a7f18a55298ffaa287336fd0c81dcd3fe45e16b6.tar.xz
musl-a7f18a55298ffaa287336fd0c81dcd3fe45e16b6.zip
have new timer threads unblock their own SIGTIMER
unblocking it in the pthread_once init function is not sufficient,
since multiple threads, some of them with the signal blocked, could
already exist before this is called; timers started from such threads
would be non-functional.
Diffstat (limited to 'src/time/timer_create.c')
-rw-r--r--src/time/timer_create.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/time/timer_create.c b/src/time/timer_create.c
index ee6a9c9d..b54a524c 100644
--- a/src/time/timer_create.c
+++ b/src/time/timer_create.c
@@ -55,8 +55,6 @@ static void install_handler()
 		.sa_flags = SA_SIGINFO | SA_RESTART
 	};
 	__libc_sigaction(SIGTIMER, &sa, 0);
-	__syscall(SYS_rt_sigprocmask, SIG_UNBLOCK,
-		SIGTIMER_SET, 0, _NSIG/8);
 }
 
 static void *start(void *arg)
@@ -72,6 +70,8 @@ static void *start(void *arg)
 
 	pthread_barrier_wait(&args->b);
 	if ((id = self->timer_id) >= 0) {
+		__syscall(SYS_rt_sigprocmask, SIG_UNBLOCK,
+			SIGTIMER_SET, 0, _NSIG/8);
 		__wait(&self->timer_id, 0, id, 1);
 		__syscall(SYS_timer_delete, id);
 	}