diff --git a/LCS/PyCommon/threading_utils.py b/LCS/PyCommon/threading_utils.py index 2ee2609586bb89f1cfe7390eac29bb43ade9ad5c..aeccb4f00512f06f4af42201ee3dddb20ccdedeb 100644 --- a/LCS/PyCommon/threading_utils.py +++ b/LCS/PyCommon/threading_utils.py @@ -30,9 +30,9 @@ import logging logger = logging.getLogger(__name__) -class TimeoutLock(object): +class TimeoutLock: """ - A TimeoutLock is a threading.Lock which you can use in a 'with' context in conjunction with a timeout. + A TimeoutLock is a threading.RLock which you can use in a 'with' context in conjunction with a timeout. Apparently a threading.Lock class cannot be subclassed, hence this quite elaborate implementation wrapping most threading.Lock methods. @@ -52,7 +52,7 @@ class TimeoutLock(object): See: https://stackoverflow.com/questions/16740104/python-lock-with-statement-and-timeout/16782391 """ def __init__(self): - self._lock = threading.Lock() + self._lock = threading.RLock() def acquire(self, blocking=True, timeout=-1): """wrapper around threading.Lock.aquire"""