From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1PxvR1-00040w-AE for garchives@archives.gentoo.org; Fri, 11 Mar 2011 06:02:47 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7A02B1C02C; Fri, 11 Mar 2011 06:02:38 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 49A661C02C for ; Fri, 11 Mar 2011 06:02:38 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BA3AE1B4004 for ; Fri, 11 Mar 2011 06:02:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 110018006A for ; Fri, 11 Mar 2011 06:02:37 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <33946e6594e16d1c8ff493cf71b8587878ec7b29.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/PollScheduler.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 33946e6594e16d1c8ff493cf71b8587878ec7b29 Date: Fri, 11 Mar 2011 06:02:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 9ec2afa0d72a8be02dfb18b499a9d2b1 commit: 33946e6594e16d1c8ff493cf71b8587878ec7b29 Author: Zac Medico gentoo org> AuthorDate: Fri Mar 11 05:21:19 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Mar 11 05:21:19 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D33946e65 PollScheduler: call _terminate_tasks in _schedule This prevents it from being called while the _schedule_tasks() implementation is running, in order to avoid potential interference. --- pym/_emerge/PollScheduler.py | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pym/_emerge/PollScheduler.py b/pym/_emerge/PollScheduler.py index a319066..94fd924 100644 --- a/pym/_emerge/PollScheduler.py +++ b/pym/_emerge/PollScheduler.py @@ -57,9 +57,11 @@ class PollScheduler(object): def _terminate_tasks(self): """ Send signals to terminate all tasks. This is called once - from the event dispatching thread. All task should be - cleaned up at the earliest opportunity, but not necessarily - before this method returns. + from self._schedule() in the event dispatching thread. This + prevents it from being called while the _schedule_tasks() + implementation is running, in order to avoid potential + interference. All tasks should be cleaned up at the earliest + opportunity, but not necessarily before this method returns. """ raise NotImplementedError() =20 @@ -74,6 +76,12 @@ class PollScheduler(object): return False self._scheduling =3D True try: + + if self._terminated.is_set() and \ + not self._terminated_tasks: + self._terminated_tasks =3D True + self._terminate_tasks() + return self._schedule_tasks() finally: self._scheduling =3D False @@ -145,10 +153,6 @@ class PollScheduler(object): raises StopIteration if timeout is None and there are no file descriptors to poll. """ - if self._terminated.is_set() and \ - not self._terminated_tasks: - self._terminated_tasks =3D True - self._terminate_tasks() if not self._poll_event_queue: self._poll(timeout) if not self._poll_event_queue: