* Move collections.deque() in from the sandbox
* Add unittests, newsitem, and whatsnew
* Apply to Queue.py mutex.py threading.py pydoc.py and shlex.py
* Docs are forthcoming
diff --git a/Lib/mutex.py b/Lib/mutex.py
index e15710a..5d35bdf 100644
--- a/Lib/mutex.py
+++ b/Lib/mutex.py
@@ -12,11 +12,13 @@
for lock, where a function is called once the lock is aquired.
"""
+from collections import deque
+
class mutex:
def __init__(self):
"""Create a new mutex -- initially unlocked."""
self.locked = 0
- self.queue = []
+ self.queue = deque()
def test(self):
"""Test the locked bit of the mutex."""
@@ -44,7 +46,7 @@
"""Unlock a mutex. If the queue is not empty, call the next
function with its argument."""
if self.queue:
- function, argument = self.queue.pop(0)
+ function, argument = self.queue.popleft()
function(argument)
else:
self.locked = 0