From cd3bb38412cfcc3bc47985ba25287e0af463609a Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 6 Apr 2011 09:26:41 -0400 Subject: fix signal-based timers with null sigevent argument since timer_create is no longer allocating a structure for the timer_t and simply using the kernel timer id, it was impossible to specify the timer_t as the argument to the signal handler. the solution is to pass the null sigevent pointer on to the kernel, rather than filling it in userspace, so that the kernel does the right thing. however, that precludes the clever timerid-versus-threadid encoding we were doing. instead, just assume timerids are below 1M and thread pointers are above 1M. (in perspective: timerids are sequentially allocated and seem limited to 32k, and thread pointers are at roughly 3G.) --- src/time/timer_delete.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/time/timer_delete.c') diff --git a/src/time/timer_delete.c b/src/time/timer_delete.c index 7c82b183..f05b27d5 100644 --- a/src/time/timer_delete.c +++ b/src/time/timer_delete.c @@ -3,7 +3,6 @@ int timer_delete(timer_t t) { - if ((uintptr_t)t & 1) - return __syscall(SYS_timer_delete, ((unsigned long)t / 2)); - return pthread_cancel(t); + if ((uintptr_t)t >= 0x100000) return pthread_cancel(t); + return __syscall(SYS_timer_delete, (long)t); } -- cgit v1.2.1