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

Method read_lock

src/filelock/_sqlite/_async.py:68–84  ·  view source on GitHub ↗

Hold the lock until the context exits. See :meth:`acquire_read` 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

66
67 @asynccontextmanager
68 async def read_lock(self, timeout: float | None = None, *, blocking: bool | None = None) -> AsyncGenerator[None]:
69 """
70 Hold the lock until the context exits. See :meth:`acquire_read` for acquisition errors.
71
72 :param timeout: seconds to wait, or ``None`` for the instance default
73 :param blocking: wait on contention, or ``None`` for the instance default
74 :yields: while the lock is held
75 """
76 await self.acquire_read(timeout, blocking=blocking)
77 body_error: BaseException | None = None
78 try:
79 yield
80 except BaseException as error:
81 body_error = error
82 raise
83 finally:
84 await self._release_in_context(body_error)
85
86 async def acquire_read(
87 self, timeout: float | None = None, *, blocking: bool | None = None

Calls 2

acquire_readMethod · 0.95
_release_in_contextMethod · 0.95