MCPcopy
hub / github.com/cft0808/edict / _lock_exclusive

Function _lock_exclusive

scripts/file_lock.py:40–45  ·  view source on GitHub ↗

获取排他锁(写锁)。

(fd: int)

Source from the content-addressed store, hash-verified

38
39
40def _lock_exclusive(fd: int) -> None:
41 """获取排他锁(写锁)。"""
42 if _IS_WINDOWS:
43 msvcrt.locking(fd, msvcrt.LK_LOCK, 1)
44 else:
45 fcntl.flock(fd, fcntl.LOCK_EX)
46
47
48def _unlock(fd: int) -> None:

Callers 2

atomic_json_updateFunction · 0.85
atomic_json_writeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected