]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
use True and False
authorBenjamin Peterson <benjamin@python.org>
Tue, 27 Jan 2009 23:15:48 +0000 (23:15 +0000)
committerBenjamin Peterson <benjamin@python.org>
Tue, 27 Jan 2009 23:15:48 +0000 (23:15 +0000)
Lib/mutex.py

index 9e6b8d43c7b5b3258ac0dfcfba040050df1d92aa..f8acba4a35f93301bea1c528fb3286dc2384b33d 100644 (file)
@@ -20,7 +20,7 @@ from collections import deque
 class mutex:
     def __init__(self):
         """Create a new mutex -- initially unlocked."""
-        self.locked = 0
+        self.locked = False
         self.queue = deque()
 
     def test(self):
@@ -31,7 +31,7 @@ class mutex:
         """Atomic test-and-set -- grab the lock if it is not set,
         return True if it succeeded."""
         if not self.locked:
-            self.locked = 1
+            self.locked = True
             return True
         else:
             return False
@@ -52,4 +52,4 @@ class mutex:
             function, argument = self.queue.popleft()
             function(argument)
         else:
-            self.locked = 0
+            self.locked = False