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

Function read

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

Source from the content-addressed store, hash-verified

57 both_inside = asyncio.Event()
58
59 async def read() -> None:
60 nonlocal readers
61 async with lock.read_lock(timeout=TASK_WAIT):
62 readers += 1
63 if readers == 2:
64 both_inside.set()
65 await asyncio.wait_for(both_inside.wait(), TASK_WAIT)
66
67 await asyncio.gather(read(), read())
68 await lock.close()

Calls 2

waitMethod · 0.80
read_lockMethod · 0.45

Tested by

no test coverage detected