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

Function thread_work

tests/core/test_threading.py:49–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 finished: list[None] = []
48
49 def thread_work() -> None:
50 name = threading.current_thread().name
51 for _ in range(10):
52 with lock:
53 holders.append(name)
54 # GraalPy handles integer zero and float zero differently.
55 time.sleep(0.0) # give up the GIL so an overlapping holder has a chance to show in the slot
56 assert holders == [name]
57 assert lock.is_locked
58 holders.pop()
59 finished.append(None)
60
61 threads = [WorkerThread(target=thread_work, name=f"t{i}") for i in range(100)]
62 for thread in threads:

Callers

nothing calls this directly

Calls 1

sleepMethod · 0.80

Tested by

no test coverage detected