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

Function write

tests/sqlite/test_async_contention.py:33–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 inside = peak = 0
32
33 async def write() -> None:
34 nonlocal inside, peak
35 async with lock.write_lock(timeout=TASK_WAIT):
36 inside += 1
37 peak = max(peak, inside)
38 await asyncio.sleep(0)
39 inside -= 1
40
41 await asyncio.gather(*(write() for _ in range(20)))
42 await lock.close()

Calls 2

sleepMethod · 0.80
write_lockMethod · 0.45

Tested by

no test coverage detected