Message379297
Put the other way, if you wanted to fix this bug in ThreadedChildWatcher, and go as far as allowing cancelling Process.wait(), followed by kill() / send_signal(), then I think you need -
* siginterrupt(SIGCHLD, 1)
* not to mind about any random C code that doesn't really handle being interrupted. Like printf(), ho hum. https://groups.google.com/g/comp.unix.programmer/c/QZmFw1VytYs/m/BSBXBHTI1REJ
* add & use a new call like os.waitpid_interruptible(), which doesn't restart on EINTR, as a workaround for PEP-475.
* set a "stop" flag for the watcher thread
* use threading.pthread_kill() (available on *most* python platforms) to interrupt the watcher thread. Spoof SIGCHLD, this will avoid conflicts with a python handler for any other signal.
* wait for the watcher thread to finish using Thread.join()
* now you can safely find out whether the child process has been reaped, or whether it's safe to kill it. |
|
Date |
User |
Action |
Args |
2020-10-22 15:09:14 | sourcejedi | set | recipients:
+ sourcejedi, asvetlov, yselivanov |
2020-10-22 15:09:14 | sourcejedi | set | messageid: <1603379354.86.0.775958990646.issue42110@roundup.psfhosted.org> |
2020-10-22 15:09:14 | sourcejedi | link | issue42110 messages |
2020-10-22 15:09:14 | sourcejedi | create | |
|