ABSTRACT
Task Management In the previous chapter, I specified that a task is either an infinite loop function or a function that deletes itself when it is done executing. Note that the task code is not actually deleted — µC/OS-II simply doesn’t know about the task anymore, so that code will not run. A task looks just like any other C function, containing a return type and an argument, but the task must never return. The return type of a task must always be declared void. The functions described in this chapter are found in the file OS_TASK.C. A task must have one of the two structures:
void YourTask (void *pdata)
{
for (;;) {
/* USER CODE */
Call one of uC/OS-II's services:
OSFlagPend();
OSMboxPend();
OSMutexPend();
OSQPend();
OSSemPend();
OSTaskSuspend(OS_PRIO_SELF);
OSTimeDly();
OSTimeDlyHMSM();
/* USER CODE */
}
}
This chapter describes the services that allow your application to create a task, delete a task, change a task’s priority, suspend and resume a task, and obtain information about a task.