diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-02-16 19:08:07 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-02-16 19:08:07 -0800 |
commit | bbcfd4e2ad7f9d97ee7bb027b5345c2d5bbb3997 (patch) | |
tree | d89fce58d22e0b7f5108b12a75773893b1957c19 | |
parent | f5e04fa4d74fc404cb067ecedf1adb7e5fc8846f (diff) | |
download | portage-bbcfd4e2ad7f9d97ee7bb027b5345c2d5bbb3997.tar.gz portage-bbcfd4e2ad7f9d97ee7bb027b5345c2d5bbb3997.tar.bz2 portage-bbcfd4e2ad7f9d97ee7bb027b5345c2d5bbb3997.zip |
EventLoop: wakeup poll loop to receive sigchild
TODO: Find out why SIGCHLD signals aren't delivered during poll calls,
forcing us to wakeup in order to receive them. This fixes random hangs
in poll calls since commit 1979a6cdfcd8c6bae4565982d82d862be07ba5be.
-rw-r--r-- | pym/portage/util/_eventloop/EventLoop.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/pym/portage/util/_eventloop/EventLoop.py b/pym/portage/util/_eventloop/EventLoop.py index 9ca529fe1..e38134258 100644 --- a/pym/portage/util/_eventloop/EventLoop.py +++ b/pym/portage/util/_eventloop/EventLoop.py @@ -19,6 +19,10 @@ class EventLoop(object): supports_multiprocessing = True + # TODO: Find out why SIGCHLD signals aren't delivered during poll + # calls, forcing us to wakeup in order to receive them. + _sigchld_interval = 250 + class _child_callback_class(SlotObject): __slots__ = ("callback", "data", "pid", "source_id") @@ -185,7 +189,14 @@ class EventLoop(object): if not self._poll_event_queue: if may_block: - timeout = self._timeout_interval + if self._child_handlers: + if self._timeout_interval is None: + timeout = self._sigchld_interval + else: + timeout = min(self._sigchld_interval, + self._timeout_interval) + else: + timeout = self._timeout_interval else: timeout = 0 try: |