Versions Compared

Key

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

...

Files

os.h/os_task.c

Prototype

Code Block
OS_SEM_CTR  OSTaskSemPend (OS_TICK   timeout,
                           OS_OPT    opt,
                           CPU_TS   *p_ts,
                           OS_ERR   *p_err)

Arguments

timeout

allows the task to resume execution if a signal is not received from a task or an ISR within the specified number of clock ticks. A timeout value of 0 indicates that the task wants to wait forever for a signal. The timeout value is not synchronized with the clock tick. The timeout count starts decrementing on the next clock tick, which could potentially occur immediately.

...

  1. Do not call OSTaskSemPend() from an ISR.

Example Usage

Code Block
          void CommTask(void *p_arg)
          {
              OS_ERR      err;
              OS_SEM_CTR  ctr;
              CPU_TS      ts;
           
           
              (void)&p_arg;
              while (DEF_ON) {
                  :
                  ctr = OSTaskSemPend(100,
                                      OS_OPT_PEND_BLOCKING,
                                      &ts,
                                      &err);
                  /* Check "err" */
                  :
                  :
              }
          }