[More about co-routines…]
A co-routine can exist in one of the following states:
When a co-routine is actually executing it is said to be in the Running state. It is currently utilising the processor.
Ready co-routines are those that are able to execute (they are not blocked) but are not currently executing. A co-routine may be in the Ready state because:
- Another co-routine of equal or higher priority is already in the Running state, or
- A task is in the Running state – this can only be the case if the application uses both tasks and co-routines.
A co-routine is said to be in the Blocked state if it is currently waiting for either a temporal or external event. For example, if a co-routine calls crDELAY() it will block (be placed into the Blocked state) until the delay period has expired – a temporal event. Blocked co-routines are not available for scheduling.
Valid co-routine state transitions