aboutsummaryrefslogtreecommitdiff
path: root/helpers/lock.py
diff options
context:
space:
mode:
Diffstat (limited to 'helpers/lock.py')
-rw-r--r--helpers/lock.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/helpers/lock.py b/helpers/lock.py
index dff8b1f..85d281a 100644
--- a/helpers/lock.py
+++ b/helpers/lock.py
@@ -5,6 +5,12 @@ class Lock:
5 self.type = lock_type 5 self.type = lock_type
6 self.lock = threading.RLock() 6 self.lock = threading.RLock()
7 7
8 def __enter__(self, *args, **kwargs):
9 self.acquire(*args, **kwargs)
10
11 def __exit__(self, type, value, traceback, *args, **kwargs):
12 self.release(*args, **kwargs)
13
8 def acquire(self, *args, **kwargs): 14 def acquire(self, *args, **kwargs):
9 #print("acquiring lock for {}".format(self.type)) 15 #print("acquiring lock for {}".format(self.type))
10 self.lock.acquire(*args, **kwargs) 16 self.lock.acquire(*args, **kwargs)