diff options
author | Zac Medico <zmedico@gentoo.org> | 2013-01-06 03:15:49 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2013-01-06 03:15:49 -0800 |
commit | 4ac9adbb25e1f83853976cba374d94b2a82ef124 (patch) | |
tree | b0ba7bb3515433047d00646a0deacb1812f60cab | |
parent | b04d876dc648c4e813ddc5f3036c5d3c94a41b74 (diff) | |
download | portage-4ac9adbb25e1f83853976cba374d94b2a82ef124.tar.gz portage-4ac9adbb25e1f83853976cba374d94b2a82ef124.tar.bz2 portage-4ac9adbb25e1f83853976cba374d94b2a82ef124.zip |
_keep_scheduling: check _terminated.is_set()
This ensures that scheduling loops terminate as soon as possible after
an interrupt is received.
-rw-r--r-- | pym/_emerge/Scheduler.py | 4 | ||||
-rw-r--r-- | pym/portage/util/_async/AsyncScheduler.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index a42327473..c2f2459f4 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -1,4 +1,4 @@ -# Copyright 1999-2012 Gentoo Foundation +# Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function @@ -1531,7 +1531,7 @@ class Scheduler(PollScheduler): self._config_pool[settings['EROOT']].append(settings) def _keep_scheduling(self): - return bool(not self._terminated_tasks and self._pkg_queue and \ + return bool(not self._terminated.is_set() and self._pkg_queue and \ not (self._failed_pkgs and not self._build_opts.fetchonly)) def _is_work_scheduled(self): diff --git a/pym/portage/util/_async/AsyncScheduler.py b/pym/portage/util/_async/AsyncScheduler.py index 182e19ee8..9b96c6f36 100644 --- a/pym/portage/util/_async/AsyncScheduler.py +++ b/pym/portage/util/_async/AsyncScheduler.py @@ -1,4 +1,4 @@ -# Copyright 2012 Gentoo Foundation +# Copyright 2012-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from portage import os @@ -38,7 +38,7 @@ class AsyncScheduler(AsynchronousTask, PollScheduler): raise NotImplementedError(self) def _keep_scheduling(self): - return self._remaining_tasks and not self._terminated_tasks + return self._remaining_tasks and not self._terminated.is_set() def _running_job_count(self): return len(self._running_tasks) |