Menu

#72 Don't use signals to wake up the event loop

v1.0_(example)
wont-fix
nobody
None
5
2015-01-23
2015-01-23
No

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()).

Discussion

  • Corey Minyard

    Corey Minyard - 2015-01-23
    • status: open --> wont-fix
     
  • Corey Minyard

    Corey Minyard - 2015-01-23

    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.

     

Log in to post a comment.