From 3990c5c6a40440cdb14746ac080d0ecf8d5d6733 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Wed, 30 Mar 2011 13:04:55 -0400 Subject: avoid all malloc/free in timer creation/destruction instead of allocating a userspace structure for signal-based timers, simply use the kernel timer id. we use the fact that thread pointers will always be zero in the low bit (actually more) to encode integer timerid values as pointers. also, this change ensures that the timer_destroy syscall has completed before the library timer_destroy function returns, in case it matters. --- src/time/timer_getoverrun.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/time/timer_getoverrun.c') diff --git a/src/time/timer_getoverrun.c b/src/time/timer_getoverrun.c index 1334e451..fa7715bb 100644 --- a/src/time/timer_getoverrun.c +++ b/src/time/timer_getoverrun.c @@ -3,5 +3,7 @@ int timer_getoverrun(timer_t t) { - return syscall(SYS_timer_getoverrun, t->timerid); + if ((uintptr_t)t & 1) t = (void *)((unsigned long)t / 2); + else t = ((pthread_t)t)->result; + return syscall(SYS_timer_getoverrun, (long)t); } -- cgit v1.2.1