Code: Select all
@monitor(3)
async def bar(t):
await asyncio.sleep_ms(t)
There is also provision for detection of CPU hogging, with a trigger pulse being generated if scheduling is blocked for longer than a chosen period. The above image shows this in action, with the "hog detect" pulse on line 00 triggering the logic analyser. Lines 01 and 03 are regularly running tasks, line 02 is a fast running task used for hog detection. Note that all tasks have been blocked for a period by another task which deliberately monopolises the CPU to demonstrate this detection.
The cases of tasks being interrupted by timeout or cancellation, and the case of multiple concurrent instances of a single task, are (hopefully) handled.