> This is actually fairly in line with how the Musl libc implements this (at
> least from a quick look).  There are a few important details in there, but
> it looks quite clean.
> 
> http://git.musl-libc.org/cgit/musl/tree/src/time/timer_create.c
> 
> While Musl is usually not as fast as glibc, I find the implementations
> usually more straight forward and smaller code size.
> 
> >
> 

>From what I see glibc does a similar thing: has one thread that expects a 
>signal (and waits for it with sigwait) and
spawns a new thread to run the user-supplied callback. I think that using a 
single thread to run the callback should be enough (although it could easily be 
made an option to spawn a new thread each time). In this scenario 
SIGEV_THREAD_ID ammounts to simply skipping the thread creation and letting the 
user specify which thread so send the signal to.

What I'm unsure about is if using a signal is really necessary. It seems that 
using a semaphore/condition variable would be simpler and maybe faster.

Do you think we could do something like this? It would be great to make 
SIGEV_THREAD more usable.

Best,
Matias

Reply via email to