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

Method write_lock

src/filelock/_sqlite/_async.py:136–152  ·  view source on GitHub ↗

Hold the lock until the context exits. See :meth:`acquire_write` for acquisition errors. :param timeout: seconds to wait, or ``None`` for the instance default :param blocking: wait on contention, or ``None`` for the instance default :yields: while the lock is held

(self, timeout: float | None = None, *, blocking: bool | None = None)

Source from the content-addressed store, hash-verified

134
135 @asynccontextmanager
136 async def write_lock(self, timeout: float | None = None, *, blocking: bool | None = None) -> AsyncGenerator[None]:
137 """
138 Hold the lock until the context exits. See :meth:`acquire_write` for acquisition errors.
139
140 :param timeout: seconds to wait, or ``None`` for the instance default
141 :param blocking: wait on contention, or ``None`` for the instance default
142 :yields: while the lock is held
143 """
144 await self.acquire_write(timeout, blocking=blocking)
145 body_error: BaseException | None = None
146 try:
147 yield
148 except BaseException as error:
149 body_error = error
150 raise
151 finally:
152 await self._release_in_context(body_error)
153
154 async def acquire_write(
155 self, timeout: float | None = None, *, blocking: bool | None = None

Calls 2

acquire_writeMethod · 0.95
_release_in_contextMethod · 0.95