Don't use signals to wake up the event loop
Brought to you by:
cminyard
Hi!
OpenIPMI is using a signal to wake up the select() loop when the timeout needs to be recomputed. When used as a library this is harmful since a signal handler could have been installed and triggered.
Please, use a file descriptor instead (send a bytes to a dedicated file descriptor to wake up the select()).
I don't think there is an easy way to use a file descriptor to do this function. The trouble is that you can't wake up a specific thread using a file descriptor.
You could create a file descriptor per thread that is waiting, but the overhead for that would be rather high.
You could block all waiting threads until the full wakeup operation is complete, but that would be really bad for multithreading performance.
The user passes in the signal they wish to use for this function, so they should know what signal is being used. So it shouldn't be harmful to the user.
If you can propose a solution, I'm happy to look at it. But I don't see how it can be done easily.