IntrOS
Loading...
Searching...
No Matches
intros::Semaphore Struct Reference

create and initialize a semaphore object More...

#include <ossemaphore.h>

Inheritance diagram for intros::Semaphore:

Public Types

using Ptr = std::unique_ptr<Semaphore>
 result type of Create()

Public Member Functions

constexpr Semaphore ()
 constructor, see the constructor parameters of the class
constexpr Semaphore (const unsigned _init, const unsigned _limit=semDefault)
 constructor, see the constructor parameters of the class
 Semaphore (Semaphore &&_src)
 move constructor
 Semaphore (const Semaphore &)=delete
Semaphore & operator= (Semaphore &&)=delete
Semaphore & operator= (const Semaphore &)=delete
void reset ()
 sem_reset()
void kill ()
 sem_kill()
int take ()
 sem_take()
int tryWait ()
 sem_tryWait()
template<typename T>
int waitFor (const T &_delay)
 sem_waitFor()
template<typename T>
int waitUntil (const T &_time)
 sem_waitUntil()
int wait ()
 sem_wait()
int give ()
 sem_give()
int post ()
 sem_post()
int release (unsigned _num)
 sem_release()
unsigned getValue ()
 sem_getValue()
int takeAsync ()
 sem_takeAsync()
int waitAsync ()
 sem_waitAsync()
int giveAsync ()
 sem_giveAsync()

Static Public Member Functions

static Semaphore Direct ()
 create and initialize static direct semaphore
static Semaphore Binary (const unsigned _init=0)
 create and initialize static binary semaphore
static Semaphore Counting (const unsigned _init=0)
 create and initialize static counting semaphore

Detailed Description

create and initialize a semaphore object

Constructor parameters
  • init: initial value of semaphore counter
  • limit: maximum value of semaphore counter
    • semDirect: direct semaphore
    • semBinary: binary semaphore
    • semCounting: counting semaphore (default)
    • otherwise: limited semaphore

Member Function Documentation

◆ Direct()

Semaphore intros::Semaphore::Direct ( )
inlinestatic

create and initialize static direct semaphore

Returns
Semaphore object

◆ Binary()

Semaphore intros::Semaphore::Binary ( const unsigned _init = 0)
inlinestatic

create and initialize static binary semaphore

Parameters
_initinitial value of semaphore counter
Returns
Semaphore object

◆ Counting()

Semaphore intros::Semaphore::Counting ( const unsigned _init = 0)
inlinestatic

create and initialize static counting semaphore

Parameters
_initinitial value of semaphore counter
Returns
Semaphore object

The documentation for this struct was generated from the following file: