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.77) (envelope-from ) id 1Sljru-0008LF-H7 for garchives@archives.gentoo.org; Mon, 02 Jul 2012 16:52:58 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 860BBE07DD; Mon, 2 Jul 2012 16:52:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 52944E07DD for ; Mon, 2 Jul 2012 16:52:36 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A3C7B1B40C7 for ; Mon, 2 Jul 2012 16:52:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 61325E5443 for ; Mon, 2 Jul 2012 16:52:28 +0000 (UTC) From: "André Erdmann" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "André Erdmann" Message-ID: <1341247644.5092211ac965d6f24d1a665c7aa7ce0ee292a4f1.dywi@gentoo> Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/depres/ X-VCS-Repository: proj/R_overlay X-VCS-Files: roverlay/depres/communication.py X-VCS-Directories: roverlay/depres/ X-VCS-Committer: dywi X-VCS-Committer-Name: André Erdmann X-VCS-Revision: 5092211ac965d6f24d1a665c7aa7ce0ee292a4f1 X-VCS-Branch: master Date: Mon, 2 Jul 2012 16:52:28 +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: a6c00dac-cd98-4e58-970c-62e0c7b272e3 X-Archives-Hash: 777f32cd3acc1c0f223ddef027dd857d commit: 5092211ac965d6f24d1a665c7aa7ce0ee292a4f1 Author: Andr=C3=A9 Erdmann mailerd de> AuthorDate: Mon Jul 2 16:47:24 2012 +0000 Commit: Andr=C3=A9 Erdmann mailerd de> CommitDate: Mon Jul 2 16:47:24 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/R_overlay.git= ;a=3Dcommit;h=3D5092211a depres channels: lock id generator usage modified: roverlay/depres/communication.py --- roverlay/depres/communication.py | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/roverlay/depres/communication.py b/roverlay/depres/communica= tion.py index 14d6193..daeb79e 100644 --- a/roverlay/depres/communication.py +++ b/roverlay/depres/communication.py @@ -6,13 +6,11 @@ import threading import sys =20 def channel_counter (): - lock =3D threading.Lock() last_id =3D long ( -1 ) if sys.version_info < ( 3, ) else int ( -1 ) =20 while True: - with lock: - last_id +=3D 1 - yield last_id + last_id +=3D 1 + yield last_id =20 =20 class DependencyResolverListener ( object ): @@ -59,6 +57,7 @@ class DependencyResolverListener ( object ): =20 class DependencyResolverChannel ( object ): =20 + id_gen_lock =3D threading.Lock() id_generator =3D channel_counter() =20 def __init__ ( self, main_resolver ): @@ -73,7 +72,8 @@ class DependencyResolverChannel ( object ): #super ( DependencyResolverChannel, self ) . __init__ () # channel identifiers must be unique even when the channel has been # deleted (id does not guarantee that) - self.ident =3D next ( DependencyResolverChannel.id_generator = ) + with DependencyResolverChannel.id_gen_lock: + self.ident =3D next ( DependencyResolverChannel.id_generator ) self._depres_master =3D main_resolver # --- end of __init__ (...) --- =20