(self)
| 55 | |
| 56 | @contextlib.contextmanager |
| 57 | def read(self) -> Iterator[None]: |
| 58 | with self._condition: |
| 59 | while self._writer: |
| 60 | self._condition.wait() |
| 61 | self._readers += 1 |
| 62 | try: |
| 63 | yield |
| 64 | finally: |
| 65 | with self._condition: |
| 66 | self._readers -= 1 |
| 67 | if self._readers == 0: |
| 68 | self._condition.notify_all() |
| 69 | |
| 70 | @contextlib.contextmanager |
| 71 | def write(self) -> Iterator[None]: |
no outgoing calls
no test coverage detected