_keep_scheduling: check _terminated.is_set()
authorZac Medico <zmedico@gentoo.org>
Sun, 6 Jan 2013 11:15:49 +0000 (03:15 -0800)
committerZac Medico <zmedico@gentoo.org>
Sun, 6 Jan 2013 11:15:49 +0000 (03:15 -0800)
This ensures that scheduling loops terminate as soon as possible after
an interrupt is received.

pym/_emerge/Scheduler.py
pym/portage/util/_async/AsyncScheduler.py

index a4232747371628e3c7ff273bb45a7093bd478748..c2f2459f405a04d3313485a3d02857c8b2b6d424 100644 (file)
@@ -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):
index 182e19ee8c3fc49e73254408af84ad23e5e68adb..9b96c6f36249d3f9d8f1e654e4f41c194dcf3c8b 100644 (file)
@@ -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)