diff options
author | Jim Fulton <jim@zope.com> | 2004-07-14 19:11:50 (GMT) |
---|---|---|
committer | Jim Fulton <jim@zope.com> | 2004-07-14 19:11:50 (GMT) |
commit | d15dc06df062fdf0fe8badec2982c6c5e0e28eb0 (patch) | |
tree | e0295c2c22fa7c2e702b37a1d7afd77547a8894f /Lib/threading.py | |
parent | e827437f45510d9cdd1e7fa561da8084f69ca698 (diff) | |
download | cpython-d15dc06df062fdf0fe8badec2982c6c5e0e28eb0.zip cpython-d15dc06df062fdf0fe8badec2982c6c5e0e28eb0.tar.gz cpython-d15dc06df062fdf0fe8badec2982c6c5e0e28eb0.tar.bz2 |
Implemented thread-local data as proposed on python-dev:
http://mail.python.org/pipermail/python-dev/2004-June/045785.html
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index e70c61b..c485524 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -15,7 +15,7 @@ from collections import deque # Rename some stuff so "from threading import *" is safe __all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', - 'Timer', 'setprofile', 'settrace'] + 'Timer', 'setprofile', 'settrace', 'local'] _start_new_thread = thread.start_new_thread _allocate_lock = thread.allocate_lock @@ -661,6 +661,14 @@ def enumerate(): _MainThread() +# get thread-local implementation, either from the thread +# module, or from the python fallback + +try: + from thread import _local as local +except ImportError: + from _threading_local import local + # Self-test code |