while True:
+ state_change = 0
+
# When the number of jobs and merges drops to zero,
# process a single merge from _merge_wait_queue if
# it's not empty. We only process one since these are
not self._task_queues.merge):
task = self._merge_wait_queue.popleft()
task.addExitListener(self._merge_wait_exit_handler)
+ self._merge_wait_scheduled.append(task)
self._task_queues.merge.add(task)
self._status_display.merges = len(self._task_queues.merge)
- self._merge_wait_scheduled.append(task)
+ state_change += 1
- self._schedule_tasks_imp()
- self._status_display.display()
+ if self._schedule_tasks_imp():
+ state_change += 1
- state_change = 0
- for q in self._task_queues.values():
- if q.schedule():
- state_change += 1
+ self._status_display.display()
# Cancel prefetchers if they're the only reason
# the main poll loop is still running.
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import sys
def add(self, task):
self._task_queue.append(task)
self._dirty = True
+ self.schedule()
def addFront(self, task):
self._task_queue.appendleft(task)
self._dirty = True
+ self.schedule()
def schedule(self):
self.running_tasks.remove(task)
if self._task_queue:
self._dirty = True
+ self.schedule()
def clear(self):
self._task_queue.clear()