summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/portage/util/_eventloop/EventLoop.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/pym/portage/util/_eventloop/EventLoop.py b/pym/portage/util/_eventloop/EventLoop.py
index 7f171fb8c..37a971e40 100644
--- a/pym/portage/util/_eventloop/EventLoop.py
+++ b/pym/portage/util/_eventloop/EventLoop.py
@@ -176,11 +176,14 @@ class EventLoop(object):
if not event_handlers:
if not events_handled and may_block and \
self._timeout_interval is not None:
- # Sleep so that we don't waste cpu time by looping too
+ # Block so that we don't waste cpu time by looping too
# quickly. This makes EventLoop useful for code that needs
# to wait for timeout callbacks regardless of whether or
# not any IO handlers are currently registered.
- time.sleep(self._timeout_interval/1000)
+ try:
+ self._do_poll(timeout=self._timeout_interval)
+ except StopIteration:
+ pass
if self._run_timeouts():
events_handled += 1
if not event_handlers: