summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-13 00:16:07 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-13 00:16:07 -0700
commit46243c16a2538e494d5b98e6f0d3ec17ad80d1b7 (patch)
treeaf780f360c1070a27f17a29c8d3b4d8ecb7ebabf
parent2287239ef4850da216a3ea5b83f2c445c9a04e45 (diff)
downloadportage-46243c16a2538e494d5b98e6f0d3ec17ad80d1b7.tar.gz
portage-46243c16a2538e494d5b98e6f0d3ec17ad80d1b7.tar.bz2
portage-46243c16a2538e494d5b98e6f0d3ec17ad80d1b7.zip
Add a 'condition' keyword argument to PollScheduler._schedule_wait()
which is a callable that should return True when it is desirable for the _schedule_wait() method to return.
-rw-r--r--pym/_emerge/PollScheduler.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pym/_emerge/PollScheduler.py b/pym/_emerge/PollScheduler.py
index e8082fe21..f9fe32e9a 100644
--- a/pym/_emerge/PollScheduler.py
+++ b/pym/_emerge/PollScheduler.py
@@ -205,7 +205,7 @@ class PollScheduler(object):
del self._poll_event_handlers[f]
del self._poll_event_handler_ids[reg_id]
- def _schedule_wait(self, wait_ids=None, timeout=None):
+ def _schedule_wait(self, wait_ids=None, timeout=None, condition=None):
"""
Schedule until wait_id is not longer registered
for poll() events.
@@ -231,6 +231,8 @@ class PollScheduler(object):
handler, reg_id = event_handlers[f]
handler(f, event)
event_handled = True
+ if condition is not None and condition():
+ break
if timeout is not None:
elapsed_time = time.time() - start_time
remaining_timeout = (timeout - 1000 * elapsed_time)