I’m new to freeRTOS and coroutine.
I have a question about the function of coroutine scheduler in the documentation, which says:
"vCoRoutineSchedule() executes the highest priority co-routine that is able to run. The co-routine will execute until it either blocks, yields or is preempted by a task. Co-routines execute cooperatively so one co-routine cannot be preempted by another, but can be preempted by a task."
The above paragraph seems a little bit contradicting to me.
If the scheduler always schedules the highest priority co-routine first (presumably, at every system clock tick), then I would think that a higher priority coroutine can preempt a lower priority coroutine.
However, what it continues to say is that a coroutine will keep running until it blocks itself (by crDELAY, crQUEUE_SEND, or crQUEUE_RECEIVE). In that case, what is the use of priority for coroutine?
Also, assuming no tasks are running, when coroutine A (higher priority) blocks itself for t ms, and coroutine B (lower priority) starts running, will coroutine B stops and let A to run after t ms?
Thanks in advance!