...
Files
os.h/os_task.c
Prototype
Code Block |
---|
void OSTaskSuspend (OS_TCB *p_tcb,
OS_ERR *p_err) |
Arguments
p_tcb
is a pointer to the TCB of the task the user is suspending. A NULL
pointer indicates suspension of the calling task.
...
If the call was successful and the desired task was suspended.
OS_ERR_INT_Q_FULL
If OS_CFG_ISR_POST_DEFERRED_EN
is to DEF_ENABLED
in os_cfg.h: If the deferred interrupt post queue is full.
OS_ERR_OS_NOT_RUNNING
If OS_CFG_INVALID_OS_CALLS_CHK_EN
is set to DEF_ENABLED
in os_cfg.h
: if µC/OS-III is not running yet.
...
OSTaskSuspend()
andOSTaskResume()
must be used in pairs.- A suspended task can only be resumed by
OSTaskResume()
.
Example Usage
Code Block | ||
---|---|---|
| ||
void TaskX (void *p_arg)
{
OS_ERR err;
(void)&p_arg;
while (DEF_ON) {
:
:
OSTaskSuspend((OS_TCB *)0,
&err); /* Suspend current task */
/* Check "err" */
:
:
}
} |