Versions Compared

Key

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

...

Files

os.h/os_sem.c

Prototype

Code Block
void  OSSemSet (OS_SEM      *p_sem,
                OS_SEM_CTR   cnt,
                OS_ERR      *p_err)

Arguments

p_sem

is a pointer to the semaphore that is used as a signaling mechanism.

...

  1. Do not use this function if the semaphore is used to protect a shared resource.

Example Usage

Code Block
titleOSSemSet() example usage
          OS_SEM  SwSem;
           
           
          void  Task (void  *p_arg)
          {
              OS_ERR  err;
           
           
              (void)&p_arg;
              while (DEF_ON) {
                  OSSemSet(&SwSem,      /* Reset the semaphore count */
                            0,
                           &err);
                  /* Check "err" */
                  :
                  :
              }
          }