]>
Commit | Line | Data |
---|---|---|
1 | import threading | |
2 | ||
3 | class 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 |