diff options
Diffstat (limited to 'helpers/lock.py')
-rw-r--r-- | helpers/lock.py | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/helpers/lock.py b/helpers/lock.py deleted file mode 100644 index 9beafcd..0000000 --- a/helpers/lock.py +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | import threading | ||
2 | |||
3 | from . import debug_print | ||
4 | |||
5 | class Lock: | ||
6 | def __init__(self, lock_type): | ||
7 | self.type = lock_type | ||
8 | self.lock = threading.RLock() | ||
9 | |||
10 | def __enter__(self, *args, **kwargs): | ||
11 | self.acquire(*args, **kwargs) | ||
12 | |||
13 | def __exit__(self, type, value, traceback, *args, **kwargs): | ||
14 | self.release(*args, **kwargs) | ||
15 | |||
16 | def acquire(self, *args, **kwargs): | ||
17 | #debug_print("acquiring lock for {}".format(self.type)) | ||
18 | self.lock.acquire(*args, **kwargs) | ||
19 | |||
20 | def release(self, *args, **kwargs): | ||
21 | #debug_print("releasing lock for {}".format(self.type)) | ||
22 | self.lock.release(*args, **kwargs) | ||
23 | |||