OS_SEM_CTR OSSemPost (OS_SEM *p_sem,
OS_OPT opt,
OS_ERR *p_err)
File | Called from | Code enabled by |
---|---|---|
| Task or ISR |
|
Description
A semaphore is signaled by calling OSSemPost()
. If the semaphore value is 0 or more, it is incremented, and OSSemPost()
returns to its caller. If tasks are waiting for the semaphore to be signaled, OSSemPost()
removes the highest-priority task pending for the semaphore from the waiting list and makes this task ready-to-run. The scheduler is then called to determine if the awakened task is now the highest-priority task that is ready-to-run.
Files
os.h/os_sem.c
Prototype
Arguments
p_sem
is a pointer to the semaphore.
...
The current value of the semaphore count
Required Configuration
OS_CFG_SEM_EN
must be enabled in os_cfg.h. Refer to uC-OS-III Configuration Manual
Callers
Application and ISRs.
Notes/Warnings
- Semaphores must be created before they are used.
- You can also post to a semaphore from an ISR but the semaphore must be used as a signaling mechanism and not to protect a shared resource.