MCPcopy Create free account
hub / github.com/tox-dev/filelock / write_lock

Method write_lock

src/filelock/_sqlite/_lock.py:404–416  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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 """

Calls 2

acquire_writeMethod · 0.95
releaseMethod · 0.95