Versions Compared

Key

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

Description

Deletes a semaphore. This function should be used with care as multiple tasks may rely on the presence of the semaphore. Generally speaking, before deleting a semaphore, first delete all the tasks that access the semaphore. As a rule, it is highly recommended to not delete kernel objects at run time.

Deleting the semaphore will not de-allocate the object. In other words, storage for the variable will still remain at the same location unless the semaphore is allocated dynamically from the heap. The dynamic allocation of objects has its own set of problems. Specifically, it is not recommended for embedded systems to allocate (and de-allocate) objects from the heap given the high likelihood of fragmentation.

Files

os.h/os_sem.c

Prototype

Arguments

p_sem

is a pointer to the semaphore.

...

If one or more tasks are waiting on the semaphore.

Returned Value

None

Required Configuration

OS_CFG_SEM_EN AND OS_CFG_SEM_DEL_EN must be enabled in os_cfg.h. Refer to uC-OS-III Configuration Manual

Callers

Application.

Notes/Warnings

  1. Use this call with care because other tasks might expect the presence of the semaphore.

Example Usage