##// END OF EJS Templates
lock: turn a lock into a Python context manager...
Bryan O'Sullivan -
r27797:054abf23 default
parent child Browse files
Show More
@@ -58,6 +58,12 class lock(object):
58 if self.acquirefn:
58 if self.acquirefn:
59 self.acquirefn()
59 self.acquirefn()
60
60
61 def __enter__(self):
62 return self
63
64 def __exit__(self, exc_type, exc_value, exc_tb):
65 self.release()
66
61 def __del__(self):
67 def __del__(self):
62 if self.held:
68 if self.held:
63 warnings.warn("use lock.release instead of del lock",
69 warnings.warn("use lock.release instead of del lock",
General Comments 0
You need to be logged in to leave comments. Login now