F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Os::CountingSemaphoreInterface Class Referenceabstract

#include <Os/CountingSemaphore.hpp>

Inheritance diagram for Os::CountingSemaphoreInterface:
Os::CountingSemaphore Os::Darwin::Semaphore::DarwinCountingSemaphore Os::Posix::Semaphore::PosixCountingSemaphore Os::Stub::Semaphore::StubCountingSemaphore

Public Types

enum  Status {
  OP_OK, ERROR_TIMEOUT, ERROR_INVALID, ERROR_NOT_IMPLEMENTED,
  NOT_SUPPORTED, ERROR_OTHER
}
 

Public Member Functions

 CountingSemaphoreInterface ()=default
 default constructor More...
 
virtual ~CountingSemaphoreInterface ()=default
 default virtual destructor More...
 
 CountingSemaphoreInterface (const CountingSemaphoreInterface &other)=delete
 copy constructor is forbidden More...
 
CountingSemaphoreInterfaceoperator= (const CountingSemaphoreInterface &other)=delete
 assignment operator is forbidden More...
 
virtual Status wait ()=0
 wait (decrement) the semaphore, blocking if count is zero More...
 
virtual Status waitTimeout (const Fw::TimeInterval &interval)=0
 wait on the semaphore with a timeout More...
 
virtual Status tryWait ()=0
 non-blocking attempt to decrement the semaphore More...
 
virtual Status post ()=0
 post (increment) the semaphore, potentially waking a waiting thread More...
 
virtual CountingSemaphoreHandlegetHandle ()=0
 return the underlying semaphore handle (implementation specific) More...
 

Static Public Member Functions

static CountingSemaphoreInterfacegetDelegate (CountingSemaphoreHandleStorage &aligned_new_memory, U32 initial_count)
 provide a pointer to a CountingSemaphore delegate object More...
 

Detailed Description

Definition at line 14 of file CountingSemaphore.hpp.

Member Enumeration Documentation

◆ Status

Enumerator
OP_OK 

Operation was successful.

ERROR_TIMEOUT 

Timeout occurred during wait.

ERROR_INVALID 

Invalid semaphore or argument.

ERROR_NOT_IMPLEMENTED 

Feature not implemented.

NOT_SUPPORTED 

CountingSemaphore does not support operation.

ERROR_OTHER 

All other errors.

Definition at line 16 of file CountingSemaphore.hpp.

Constructor & Destructor Documentation

◆ CountingSemaphoreInterface() [1/2]

Os::CountingSemaphoreInterface::CountingSemaphoreInterface ( )
default

default constructor

◆ ~CountingSemaphoreInterface()

virtual Os::CountingSemaphoreInterface::~CountingSemaphoreInterface ( )
virtualdefault

default virtual destructor

◆ CountingSemaphoreInterface() [2/2]

Os::CountingSemaphoreInterface::CountingSemaphoreInterface ( const CountingSemaphoreInterface other)
delete

copy constructor is forbidden

Member Function Documentation

◆ getDelegate()

CountingSemaphoreInterface * Os::CountingSemaphoreInterface::getDelegate ( CountingSemaphoreHandleStorage aligned_new_memory,
U32  initial_count 
)
static

provide a pointer to a CountingSemaphore delegate object

Definition at line 10 of file DefaultCountingSemaphore.cpp.

◆ getHandle()

virtual CountingSemaphoreHandle* Os::CountingSemaphoreInterface::getHandle ( )
pure virtual

return the underlying semaphore handle (implementation specific)

Returns
internal semaphore handle representation

Implemented in Os::CountingSemaphore, Os::Darwin::Semaphore::DarwinCountingSemaphore, Os::Posix::Semaphore::PosixCountingSemaphore, and Os::Stub::Semaphore::StubCountingSemaphore.

◆ operator=()

CountingSemaphoreInterface& Os::CountingSemaphoreInterface::operator= ( const CountingSemaphoreInterface other)
delete

assignment operator is forbidden

◆ post()

virtual Status Os::CountingSemaphoreInterface::post ( )
pure virtual

post (increment) the semaphore, potentially waking a waiting thread

Returns
status of the operation

Implemented in Os::CountingSemaphore, Os::Darwin::Semaphore::DarwinCountingSemaphore, Os::Posix::Semaphore::PosixCountingSemaphore, and Os::Stub::Semaphore::StubCountingSemaphore.

◆ tryWait()

virtual Status Os::CountingSemaphoreInterface::tryWait ( )
pure virtual

non-blocking attempt to decrement the semaphore

Returns
OP_OK if decremented, ERROR_TIMEOUT if count was zero

Implemented in Os::CountingSemaphore, Os::Darwin::Semaphore::DarwinCountingSemaphore, Os::Posix::Semaphore::PosixCountingSemaphore, and Os::Stub::Semaphore::StubCountingSemaphore.

◆ wait()

virtual Status Os::CountingSemaphoreInterface::wait ( )
pure virtual

wait (decrement) the semaphore, blocking if count is zero

Returns
status of the operation

Implemented in Os::CountingSemaphore, Os::Darwin::Semaphore::DarwinCountingSemaphore, Os::Posix::Semaphore::PosixCountingSemaphore, and Os::Stub::Semaphore::StubCountingSemaphore.

◆ waitTimeout()

virtual Status Os::CountingSemaphoreInterface::waitTimeout ( const Fw::TimeInterval interval)
pure virtual

wait on the semaphore with a timeout

Parameters
intervalmaximum time to wait
Returns
OP_OK on success, ERROR_TIMEOUT if the interval elapsed

Implemented in Os::CountingSemaphore, Os::Darwin::Semaphore::DarwinCountingSemaphore, Os::Posix::Semaphore::PosixCountingSemaphore, and Os::Stub::Semaphore::StubCountingSemaphore.


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