summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-07-20 01:00:26 +0000
committerZac Medico <zmedico@gentoo.org>2008-07-20 01:00:26 +0000
commit3ada8a67e7de6b13be6d247fecebf4ce2bfeb1c7 (patch)
tree7ba8b71222f2efdce36d042723b5eb5114242698
parent637f63d0fe6bee8035a51ed680393316c23699e4 (diff)
downloadportage-3ada8a67e7de6b13be6d247fecebf4ce2bfeb1c7.tar.gz
portage-3ada8a67e7de6b13be6d247fecebf4ce2bfeb1c7.tar.bz2
portage-3ada8a67e7de6b13be6d247fecebf4ce2bfeb1c7.zip
Make PollScheduler._poll() add poll events to the stack instead of returning
them. This makes it more useful as a hook, allowing Scheduler._poll() to safely call _schedule(). svn path=/main/trunk/; revision=11144
-rw-r--r--pym/_emerge/__init__.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index f1a07e264..ffeca1f16 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -8196,9 +8196,10 @@ class PollScheduler(object):
def _poll(self, timeout=None):
"""
- All poll() calls pass through here.
+ All poll() calls pass through here. The poll events
+ are added directly to self._poll_event_queue.
"""
- return self._poll_obj.poll(timeout)
+ self._poll_event_queue.extend(self._poll_obj.poll(timeout))
def _next_poll_event(self, timeout=None):
"""
@@ -8208,7 +8209,7 @@ class PollScheduler(object):
poll() call.
"""
if not self._poll_event_queue:
- self._poll_event_queue.extend(self._poll(timeout))
+ self._poll(timeout)
return self._poll_event_queue.pop()
def _poll_loop(self):
@@ -8240,7 +8241,7 @@ class PollScheduler(object):
return bool(events_handled)
if not self._poll_event_queue:
- self._poll_event_queue.extend(self._poll(0))
+ self._poll(0)
while event_handlers and self._poll_event_queue:
f, event = self._next_poll_event()
@@ -8773,8 +8774,8 @@ class Scheduler(PollScheduler):
self._running_root, installed=True)
def _poll(self, timeout=None):
- self._status_display.display()
- return PollScheduler._poll(self, timeout=timeout)
+ self._schedule()
+ PollScheduler._poll(self, timeout=timeout)
def _set_max_jobs(self, max_jobs):
self._max_jobs = max_jobs