Commit a0934246 authored by Guido van Rossum's avatar Guido van Rossum

Use the dummy_thread module in Queue.py and tempfile.py.

tempfile.py already contained code to let it run without threads present;
for Queue.py this is considered a useful feature too.
parent 2969233f
......@@ -16,7 +16,10 @@ class Queue:
If maxsize is <= 0, the queue size is infinite.
"""
import thread
try:
import thread
except ImportError:
import dummy_thread as thread
self._init(maxsize)
self.mutex = thread.allocate_lock()
self.esema = thread.allocate_lock()
......
......@@ -50,12 +50,9 @@ except (ImportError, AttributeError):
try:
import thread as _thread
_allocate_lock = _thread.allocate_lock
except (ImportError, AttributeError):
class _allocate_lock:
def acquire(self):
pass
release = acquire
except ImportError:
import dummy_thread as _thread
_allocate_lock = _thread.allocate_lock
_text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL
if hasattr(_os, 'O_NOINHERIT'):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment