Activated when used in the with statement. Should automatically acquire a lock to be used in the with block.
(self)
| 269 | self.is_locked = False |
| 270 | |
| 271 | def __enter__(self): |
| 272 | """ Activated when used in the with statement. |
| 273 | Should automatically acquire a lock to be used in the with block. |
| 274 | """ |
| 275 | if not self.is_locked: |
| 276 | self.acquire() |
| 277 | return self |
| 278 | |
| 279 | def __exit__(self, type, value, traceback): |
| 280 | """ Activated at the end of the with statement. |