[issue12187] subprocess.wait() with a timeout uses polling on POSIX

STINNER Victor report at bugs.python.org
Thu May 26 15:32:21 CEST 2011


New submission from STINNER Victor <victor.stinner at 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 <report at bugs.python.org>
<http://bugs.python.org/issue12187>
_______________________________________


More information about the Python-bugs-list mailing list