(lock_file: str, mode: Literal["read", "write"], sending: Connection)
| 71 | |
| 72 | |
| 73 | def _probe_read_write_lock(lock_file: str, mode: Literal["read", "write"], sending: Connection) -> None: |
| 74 | with sending: |
| 75 | lock: Final[ReadWriteLock] = ReadWriteLock(lock_file, is_singleton=False) |
| 76 | sending.send_bytes(b"") |
| 77 | acquired = False |
| 78 | try: |
| 79 | try: |
| 80 | (lock.acquire_read if mode == "read" else lock.acquire_write)(blocking=False) |
| 81 | except Timeout: |
| 82 | return |
| 83 | acquired = True |
| 84 | lock.release() |
| 85 | finally: |
| 86 | lock.close() |
| 87 | sending.send_bytes(bytes([acquired])) |
| 88 | |
| 89 | |
| 90 | def writer_gets_in(lock_file: str | os.PathLike[str]) -> bool: |
nothing calls this directly
no test coverage detected