获取共享锁(读锁)。
(fd: int)
| 30 | # ── 平台抽象:文件锁 ──────────────────────────────────────────── |
| 31 | |
| 32 | def _lock_shared(fd: int) -> None: |
| 33 | """获取共享锁(读锁)。""" |
| 34 | if _IS_WINDOWS: |
| 35 | msvcrt.locking(fd, msvcrt.LK_NBLCK, 1) |
| 36 | else: |
| 37 | fcntl.flock(fd, fcntl.LOCK_SH) |
| 38 | |
| 39 | |
| 40 | def _lock_exclusive(fd: int) -> None: |