]>
git.immae.eu Git - perso/Immae/Projets/Python/MusicSampler.git/blob - lock.py
9beafcde60c80b789b46839ae462c71245727593
3 from . import debug_print
6 def __init__(self
, lock_type
):
8 self
.lock
= threading
.RLock()
10 def __enter__(self
, *args
, **kwargs
):
11 self
.acquire(*args
, **kwargs
)
13 def __exit__(self
, type, value
, traceback
, *args
, **kwargs
):
14 self
.release(*args
, **kwargs
)
16 def acquire(self
, *args
, **kwargs
):
17 #debug_print("acquiring lock for {}".format(self.type))
18 self
.lock
.acquire(*args
, **kwargs
)
20 def release(self
, *args
, **kwargs
):
21 #debug_print("releasing lock for {}".format(self.type))
22 self
.lock
.release(*args
, **kwargs
)