In Coos, the task has four states, namely: Ready state, running state, waiting state, dormant state.
Why do you want to separate the state?
The goal is to give the CPU to more needed tasks, for example, you open a browser and open a game (need full screen), so when you play the game, let the browser this task hangs, to enter the waiting state.
Then the entire CPU is serving the game, without the advent of the card.
The same principle, can also be used in single-chip microcomputer.
1, Cogetcurtaskid (), get the task ID number
Os_tid cogetcurtaskid (void);
This function, which can only be used within the task, gets the task ID number, and allows the task to enter a different state.
Returns the Os_tid variable if the ID number is successfully obtained.
2, Cosuspendtask (), suspend task
Statustype Cosuspendtask (Os_tid TaskID);
3, Coawaketask (), Wake up task
Statustype Coawaketask (Os_tid TaskID);
After task a hangs, it cannot enter the ready state itself, and must wait for other tasks to wake it up.