Skip to content
Snippets Groups Projects
Commit c67eb402 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-699: use RLock

parent a9497879
No related branches found
No related tags found
No related merge requests found
...@@ -30,9 +30,9 @@ import logging ...@@ -30,9 +30,9 @@ import logging
logger = logging.getLogger(__name__) 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 Apparently a threading.Lock class cannot be subclassed, hence this quite elaborate implementation wrapping most
threading.Lock methods. threading.Lock methods.
...@@ -52,7 +52,7 @@ class TimeoutLock(object): ...@@ -52,7 +52,7 @@ class TimeoutLock(object):
See: https://stackoverflow.com/questions/16740104/python-lock-with-statement-and-timeout/16782391 See: https://stackoverflow.com/questions/16740104/python-lock-with-statement-and-timeout/16782391
""" """
def __init__(self): def __init__(self):
self._lock = threading.Lock() self._lock = threading.RLock()
def acquire(self, blocking=True, timeout=-1): def acquire(self, blocking=True, timeout=-1):
"""wrapper around threading.Lock.aquire""" """wrapper around threading.Lock.aquire"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment