diff options
author | Raymond Hettinger <python@rcn.com> | 2004-01-29 06:37:52 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-01-29 06:37:52 (GMT) |
commit | 756b3f3c15bd314ffa25299ca25465ae21e62a30 (patch) | |
tree | f504d3ab53c151b7e88ebfebd069a034f80f5025 /Lib/threading.py | |
parent | 141d4e564314abde44189eb5e3a9f509dab045ff (diff) | |
download | cpython-756b3f3c15bd314ffa25299ca25465ae21e62a30.zip cpython-756b3f3c15bd314ffa25299ca25465ae21e62a30.tar.gz cpython-756b3f3c15bd314ffa25299ca25465ae21e62a30.tar.bz2 |
* 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
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index c5d5af3..6461adc 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -10,6 +10,7 @@ except ImportError: from time import time as _time, sleep as _sleep from traceback import format_exc as _format_exc +from collections import deque # Rename some stuff so "from threading import *" is safe __all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event', @@ -639,7 +640,7 @@ def _test(): self.rc = Condition(self.mon) self.wc = Condition(self.mon) self.limit = limit - self.queue = [] + self.queue = deque() def put(self, item): self.mon.acquire() @@ -657,7 +658,7 @@ def _test(): while not self.queue: self._note("get(): queue empty") self.rc.wait() - item = self.queue.pop(0) + item = self.queue.popleft() self._note("get(): got %s, %d left", item, len(self.queue)) self.wc.notify() self.mon.release() |