From c67eb402e3b61efe384eb143af6b1bdaa263023a Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Mon, 3 Jun 2019 11:46:13 +0000 Subject: [PATCH] SW-699: use RLock --- LCS/PyCommon/threading_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LCS/PyCommon/threading_utils.py b/LCS/PyCommon/threading_utils.py index 2ee2609586b..aeccb4f0051 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""" -- GitLab