Async worker that yields repeatedly until stopped
(stop_event: asyncio.Event)
| 70 | |
| 71 | |
| 72 | async def worker(stop_event: asyncio.Event): |
| 73 | """Async worker that yields repeatedly until stopped""" |
| 74 | global swap_count |
| 75 | while not stop_event.is_set(): |
| 76 | swap_count += 1 |
| 77 | await asyncio.sleep(0) # simulate fiber.yield() |
| 78 | |
| 79 | |
| 80 | async def test_context_switch_async(num_tests, num_fibers): |
no outgoing calls