()
| 221 | inside = peak = 0 |
| 222 | |
| 223 | async def write_repeatedly() -> None: |
| 224 | nonlocal inside, peak |
| 225 | lock = AsyncReadWriteLock(lock_file) |
| 226 | for _ in range(20): |
| 227 | async with lock.write_lock(timeout=TASK_WAIT): |
| 228 | with guard: |
| 229 | inside += 1 |
| 230 | peak = max(peak, inside) |
| 231 | await asyncio.sleep(0) |
| 232 | with guard: |
| 233 | inside -= 1 |
| 234 | |
| 235 | threads = [threading.Thread(target=asyncio.run, args=(write_repeatedly(),), daemon=True) for _ in range(2)] |
| 236 | for thread in threads: |
no test coverage detected