Repository navigation
Conversation
It only works on single threaded processes as it manipulates global signal state.
|
There is one way to put a timeout on For extra fun, you do still need a polling timeout loop in this version, because there's a potential lost-wakeup race condition: if you try to wake up the sleeping thread just before it goes to sleep, the wakeup gets lost. This is not too hard to deal with though, just annoying – once you've decided to cancel the thread, you have to keep sending the signal until it confirms that it got it. Waiting for children is my absolute least favorite part of Linux's I/O APIs. I don't understand how this wasn't fixed years ago. |
It is only enabled on single threaded processes as it manipulates global signal state.
This PR is for discussion purposes. I suspect we do not want to go forward with this if we can create a better one using
signalfdsupport (https://bugs.python.org/issue32443) that works regardless of threads.Windows APIs for wait timeout are already great.
macOS and BSDs would each need their own set of improvements as nobody has standard APIs around this.