MCPcopy Create free account
hub / github.com/covscript/covscript / worker

Function worker

tests/benchmark.py:72–77  ·  view source on GitHub ↗

Async worker that yields repeatedly until stopped

(stop_event: asyncio.Event)

Source from the content-addressed store, hash-verified

70
71
72async 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
80async def test_context_switch_async(num_tests, num_fibers):

Callers 1

Calls

no outgoing calls

Tested by 1