New submission from STINNER Victor <victor.stin...@haypocalc.com>:

Polling should be avoided when it's possible. For subprocess.wait(), we can do 
something with signals (SIGCHLD and/or SIGCLD).

sigtimedwait() can be used to wait a the "a child process terminated" with a 
timeout, but not wait a specific process (so we may use a loop). sigtimedwait() 
doesn't call the signal handler, and so it changes the behaviour if the parent 
process has a signal handler for SIGCHLD/SIGCLD.

If sigtimedwait() is not available, we may use a signal handler. For example, 
we can use the "wakeup fd" tool of the signal module. Problem: the parent 
program may already have such handler / use "wakeup fd". We should at least 
restore the previous signal handler when we are done.

----------
assignee: pitrou
components: Library (Lib)
messages: 136958
nosy: haypo, pitrou
priority: normal
severity: normal
status: open
title: subprocess.wait() with a timeout uses polling on POSIX
type: performance
versions: Python 3.3

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

Reply via email to