NetBurner 3.3.8a
PDF Version
OS_SEM Class Reference

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.

Public Member Functions

 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...
 

Detailed Description

Semaphores are used to control access to shared resource critical section, or to communicate between tasks.

Constructor & Destructor Documentation

◆ OS_SEM()

OS_SEM::OS_SEM ( int32_t  cnt = 0)
inline

Create and initialize a semaphore.

Parameters
cntStarting count

Member Function Documentation

◆ 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
cntStarting count
Return values
OS_NO_ERRIf successful
OS_SEM_ERRIf 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
timeoutTicksNumber of system time ticks to wait. If no value is specified, it will wait forever.
Return values
OS_NO_ERRIf successful
OS_TIMEOUTIf it timed out
See also
NBRTOS Error Codes
PendNoWait()

◆ PendNoWait()

uint8_t OS_SEM::PendNoWait ( )

Pend on a semaphore with no waiting period.

Identical to the Pend() function, but it does not wait.

Return values
OS_NO_ERRIf successful
OS_TIMEOUTIf it failed
See also
NBRTOS Error Codes
Pend(uint32_t timeoutTicks)

◆ Post()

uint8_t OS_SEM::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
OS_NO_ERRIf successful
See also
NBRTOS Error Codes

The documentation for this class was generated from the following files: