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 1Ruu5Q-0007ZW-NP for garchives@archives.gentoo.org; Tue, 07 Feb 2012 23:04:32 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 04466E05F9; Tue, 7 Feb 2012 23:04:23 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id CA7B8E05F9 for ; Tue, 7 Feb 2012 23:04:23 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4C24B1B4028 for ; Tue, 7 Feb 2012 23:04:23 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id B80F580051 for ; Tue, 7 Feb 2012 23:04:22 +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: <839f369f259a7c019c1f544bf4c153058355f6d4.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/AsynchronousLock.py pym/_emerge/AsynchronousTask.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 839f369f259a7c019c1f544bf4c153058355f6d4 Date: Tue, 7 Feb 2012 23:04:22 +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: f19678d9-1ef1-4faa-82ac-d26a7706f1b5 X-Archives-Hash: 27c48be8af500d17f134ba657ccf5c5a commit: 839f369f259a7c019c1f544bf4c153058355f6d4 Author: Zac Medico gentoo org> AuthorDate: Tue Feb 7 02:52:32 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Tue Feb 7 19:12:11 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D839f369f AsynchronousTask: merge _waiting from subclass --- pym/_emerge/AsynchronousLock.py | 7 ++----- pym/_emerge/AsynchronousTask.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLo= ck.py index ae3bde4..3593834 100644 --- a/pym/_emerge/AsynchronousLock.py +++ b/pym/_emerge/AsynchronousLock.py @@ -36,7 +36,7 @@ class AsynchronousLock(AsynchronousTask): =20 __slots__ =3D ('path', 'scheduler',) + \ ('_imp', '_force_async', '_force_dummy', '_force_process', \ - '_force_thread', '_waiting') + '_force_thread') =20 _use_process_by_default =3D True =20 @@ -67,8 +67,7 @@ class AsynchronousLock(AsynchronousTask): =20 def _imp_exit(self, imp): # call exit listeners - if not self._waiting: - self.wait() + self.wait() =20 def _cancel(self): if isinstance(self._imp, AsynchronousTask): @@ -82,9 +81,7 @@ class AsynchronousLock(AsynchronousTask): def _wait(self): if self.returncode is not None: return self.returncode - self._waiting =3D True self.returncode =3D self._imp.wait() - self._waiting =3D False return self.returncode =20 def unlock(self): diff --git a/pym/_emerge/AsynchronousTask.py b/pym/_emerge/AsynchronousTa= sk.py index 36522ca..4aa5980 100644 --- a/pym/_emerge/AsynchronousTask.py +++ b/pym/_emerge/AsynchronousTask.py @@ -14,7 +14,8 @@ class AsynchronousTask(SlotObject): """ =20 __slots__ =3D ("background", "cancelled", "returncode") + \ - ("_exit_listeners", "_exit_listener_stack", "_start_listeners") + ("_exit_listeners", "_exit_listener_stack", "_start_listeners", + "_waiting") =20 def start(self): """ @@ -42,7 +43,12 @@ class AsynchronousTask(SlotObject): =20 def wait(self): if self.returncode is None: - self._wait() + if not self._waiting: + self._waiting =3D True + try: + self._wait() + finally: + self._waiting =3D False self._wait_hook() return self.returncode =20