EventLoop.iteration: run timeouts if no fds
authorZac Medico <zmedico@gentoo.org>
Sat, 11 Feb 2012 21:11:10 +0000 (13:11 -0800)
committerZac Medico <zmedico@gentoo.org>
Sat, 11 Feb 2012 21:11:10 +0000 (13:11 -0800)
pym/portage/util/_eventloop/EventLoop.py

index a7161dbd56fd877081fadae151e35efc989cb068..07d9bec884404cc8cd4bcd20786553c1a755460b 100644 (file)
@@ -162,7 +162,15 @@ class EventLoop(object):
                events_handled = 0
 
                if not event_handlers:
-                       return bool(events_handled)
+                       if not self._polling:
+                               self._polling = True
+                               try:
+                                       if self._run_timeouts():
+                                               events_handled += 1
+                               finally:
+                                       self._polling = False
+                       if not event_handlers:
+                               return bool(events_handled)
 
                if not self._poll_event_queue:
                        if may_block: