Acquire a shared read lock for the current task. :param timeout: seconds to wait, or ``None`` for the instance default :param blocking: wait on contention, or ``None`` for the instance default :returns: an async context manager that releases the lock on exit
(
self, timeout: float | None = None, *, blocking: bool | None = None
)
| 84 | await self._release_in_context(body_error) |
| 85 | |
| 86 | async def acquire_read( |
| 87 | self, timeout: float | None = None, *, blocking: bool | None = None |
| 88 | ) -> AsyncAcquireReadWriteReturnProxy: |
| 89 | """ |
| 90 | Acquire a shared read lock for the current task. |
| 91 | |
| 92 | :param timeout: seconds to wait, or ``None`` for the instance default |
| 93 | :param blocking: wait on contention, or ``None`` for the instance default |
| 94 | :returns: an async context manager that releases the lock on exit |
| 95 | :raises RuntimeError: the task already holds the write lock or inherited the wrapper after fork |
| 96 | :raises sqlite3.ProgrammingError: the wrapper is closed |
| 97 | :raises Timeout: the deadline expired |
| 98 | :raises TypeError: timeout is a boolean or not a real number, or blocking is not a boolean |
| 99 | :raises ValueError: a blocking call received NaN or a negative timeout other than -1 |
| 100 | """ |
| 101 | self._raise_if_unusable() |
| 102 | await self._acquire("read", timeout, blocking=blocking) |
| 103 | return AsyncAcquireReadWriteReturnProxy(lock=self) |
| 104 | |
| 105 | @override |
| 106 | def _raise_if_unusable(self) -> None: |