Hold an exclusive write lock for the duration of the context. :param timeout: wait in seconds, or ``None`` for the instance default :param blocking: whether to wait on contention, or ``None`` for the instance default :yields: while the write lock is held
(self, timeout: float | None = None, *, blocking: bool | None = None)
| 402 | |
| 403 | @contextmanager |
| 404 | def write_lock(self, timeout: float | None = None, *, blocking: bool | None = None) -> Generator[None]: |
| 405 | """ |
| 406 | Hold an exclusive write lock for the duration of the context. |
| 407 | |
| 408 | :param timeout: wait in seconds, or ``None`` for the instance default |
| 409 | :param blocking: whether to wait on contention, or ``None`` for the instance default |
| 410 | :yields: while the write lock is held |
| 411 | """ |
| 412 | self.acquire_write(timeout, blocking=blocking) |
| 413 | try: |
| 414 | yield |
| 415 | finally: |
| 416 | self.release() |
| 417 | |
| 418 | def acquire_write(self, timeout: float | None = None, *, blocking: bool | None = None) -> AcquireReturnProxy: |
| 419 | """ |