Semaphores are used to control access to shared resource critical section, or to communicate between tasks.
More...
#include <nbrtos.h>
Inherits OS_TASK_DLY_OBJ.
|
| OS_SEM (int32_t cnt=0) |
| Create and initialize a semaphore. More...
|
|
uint8_t | Init (int32_t cnt=0) |
| This function is used to initialize a semaphore structure. Note: This must be done before using a semaphore. More...
|
|
uint8_t | Post () |
| This function increases the value of the semaphore by one. Note: If any higher priority tasks were waiting on the semaphore - it releases them. More...
|
|
uint8_t | Pend (uint32_t timeoutTicks=WAIT_FOREVER) |
| Wait timeout ticks for the value of the semaphore to be non zero. Note: A timeout value of 0 (zero) waits forever. More...
|
|
uint8_t | PendNoWait () |
| Pend on a semaphore with no waiting period. More...
|
|
Semaphores are used to control access to shared resource critical section, or to communicate between tasks.
◆ OS_SEM()
OS_SEM::OS_SEM |
( |
int32_t |
cnt = 0 | ) |
|
|
inline |
Create and initialize a semaphore.
- Parameters
-
◆ Init()
uint8_t OS_SEM::Init |
( |
int32_t |
cnt = 0 | ) |
|
This function is used to initialize a semaphore structure. Note: This must be done before using a semaphore.
- Parameters
-
- Return values
-
OS_NO_ERR | If successful |
OS_SEM_ERR | If it fails |
- See also
- NBRTOS Error Codes
◆ Pend()
uint8_t OS_SEM::Pend |
( |
uint32_t |
timeoutTicks = WAIT_FOREVER | ) |
|
|
inline |
Wait timeout ticks for the value of the semaphore to be non zero. Note: A timeout value of 0 (zero) waits forever.
- Parameters
-
timeoutTicks | Number of system time ticks to wait. If no value is specified, it will wait forever. |
- Return values
-
OS_NO_ERR | If successful |
OS_TIMEOUT | If it timed out |
- See also
- NBRTOS Error Codes
-
PendNoWait()
◆ PendNoWait()
uint8_t OS_SEM::PendNoWait |
( |
| ) |
|
◆ Post()
This function increases the value of the semaphore by one. Note: If any higher priority tasks were waiting on the semaphore - it releases them.
- Return values
-
- See also
- NBRTOS Error Codes
The documentation for this class was generated from the following files: