Alan Jenkins <alan.christopher.jenk...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42110>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to