Commit e791dc3f authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Julien Muchembled

Control verbose locking via en environment variable

parent b7e0ec7f
...@@ -18,14 +18,12 @@ from Queue import Empty ...@@ -18,14 +18,12 @@ from Queue import Empty
This file defines a VerboseLock class implementing basic lock API and This file defines a VerboseLock class implementing basic lock API and
logging in appropriate places with extensive details. logging in appropriate places with extensive details.
It can be globaly toggled by changing VERBOSE_LOCKING value. It can be toggled globally by setting NEO_VERBOSE_LOCKING environment
variable to a non-empty value before this module is loaded.
There is no overhead at all when disabled (passthrough to threading There is no overhead at all when disabled (passthrough to threading
classes). classes).
""" """
VERBOSE_LOCKING = False
class LockUser(object): class LockUser(object):
def __init__(self, message, level=0): def __init__(self, message, level=0):
...@@ -157,7 +155,7 @@ class VerboseSemaphore(VerboseLockBase): ...@@ -157,7 +155,7 @@ class VerboseSemaphore(VerboseLockBase):
return not self.lock._Semaphore__value return not self.lock._Semaphore__value
if VERBOSE_LOCKING: if os.getenv('NEO_VERBOSE_LOCKING'):
Lock = VerboseLock Lock = VerboseLock
RLock = VerboseRLock RLock = VerboseRLock
Semaphore = VerboseSemaphore Semaphore = VerboseSemaphore
......
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