Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

...

  1. OSTaskSuspend() and OSTaskResume() must be used in pairs.
  2. A suspended task can only be resumed by OSTaskResume().

Example Usage

Code Block
titleOSTaskSuspend() example usage
          void TaskX (void *p_arg)
          {
              OS_ERR  err;
           
              (void)&p_arg;
              while (DEF_ON) {
                  :
                  :
                  OSTaskSuspend((OS_TCB *)0,
                                &err);       /* Suspend current task                       */
                  /* Check "err" */
                  :
                  :
              }
          }