Use thread.get_ident
instead of more convoluted way.
This also has the nice side-effect of not making pylibmc unusable on lte py25.
This commit is contained in:
parent
43729b93a8
commit
f96dbc740c
@ -192,7 +192,7 @@ class ThreadMappedPool(dict):
|
|||||||
Creates a new client based on the master client if none exists for the
|
Creates a new client based on the master client if none exists for the
|
||||||
current thread.
|
current thread.
|
||||||
"""
|
"""
|
||||||
key = threading.current_thread().ident
|
key = thread.get_ident()
|
||||||
mc = self.pop(key, None)
|
mc = self.pop(key, None)
|
||||||
if mc is None:
|
if mc is None:
|
||||||
mc = self.master.clone()
|
mc = self.master.clone()
|
||||||
@ -203,7 +203,7 @@ class ThreadMappedPool(dict):
|
|||||||
|
|
||||||
# This makes sure ThreadMappedPool doesn't exist with non-thread Pythons.
|
# This makes sure ThreadMappedPool doesn't exist with non-thread Pythons.
|
||||||
try:
|
try:
|
||||||
import threading
|
import thread
|
||||||
except ImportError:
|
except ImportError:
|
||||||
del ThreadMappedPool
|
del ThreadMappedPool
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user