aboutsummaryrefslogtreecommitdiff
path: root/helpers/lock.py
diff options
context:
space:
mode:
Diffstat (limited to 'helpers/lock.py')
-rw-r--r--helpers/lock.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/helpers/lock.py b/helpers/lock.py
new file mode 100644
index 0000000..dff8b1f
--- /dev/null
+++ b/helpers/lock.py
@@ -0,0 +1,15 @@
1import threading
2
3class Lock:
4 def __init__(self, lock_type):
5 self.type = lock_type
6 self.lock = threading.RLock()
7
8 def acquire(self, *args, **kwargs):
9 #print("acquiring lock for {}".format(self.type))
10 self.lock.acquire(*args, **kwargs)
11
12 def release(self, *args, **kwargs):
13 #print("releasing lock for {}".format(self.type))
14 self.lock.release(*args, **kwargs)
15