MCPcopy Create free account
hub / github.com/tox-dev/filelock / work

Function work

tests/core/test_threading.py:95–105  ·  view source on GitHub ↗
(lock: BaseFileLock)

Source from the content-addressed store, hash-verified

93 finished: list[None] = []
94
95 def work(lock: BaseFileLock) -> None:
96 name = threading.current_thread().name
97 for _ in range(100):
98 with lock:
99 holders.append(name)
100 # GraalPy handles integer zero and float zero differently.
101 time.sleep(0.0) # give up the GIL so an overlapping holder has a chance to show in the slot
102 assert holders == [name]
103 assert lock.is_locked
104 holders.pop()
105 finished.append(None)
106
107 lock_path = tmp_path / "a"
108 lock_1, lock_2 = lock_type(str(lock_path)), lock_type(str(lock_path))

Callers

nothing calls this directly

Calls 1

sleepMethod · 0.80

Tested by

no test coverage detected