F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
CountingSemaphore.cpp
Go to the documentation of this file.
2 #include "Fw/Types/Assert.hpp"
3 
4 namespace Os {
6  : m_delegate(*CountingSemaphoreInterface::getDelegate(m_handle_storage, initial_count)) {}
7 
9  m_delegate.~CountingSemaphoreInterface();
10 }
11 
13  FW_ASSERT(&this->m_delegate == reinterpret_cast<CountingSemaphoreInterface*>(&this->m_handle_storage[0]));
14  return this->m_delegate.wait();
15 }
16 
18  FW_ASSERT(&this->m_delegate == reinterpret_cast<CountingSemaphoreInterface*>(&this->m_handle_storage[0]));
19  return this->m_delegate.waitTimeout(interval);
20 }
21 
23  FW_ASSERT(&this->m_delegate == reinterpret_cast<CountingSemaphoreInterface*>(&this->m_handle_storage[0]));
24  return this->m_delegate.tryWait();
25 }
26 
28  FW_ASSERT(&this->m_delegate == reinterpret_cast<CountingSemaphoreInterface*>(&this->m_handle_storage[0]));
29  return this->m_delegate.post();
30 }
31 
33  FW_ASSERT(&this->m_delegate == reinterpret_cast<const CountingSemaphoreInterface*>(&this->m_handle_storage[0]));
34  return this->m_delegate.getHandle();
35 }
36 
37 } // namespace Os
~CountingSemaphore() final
Destructor.
CountingSemaphoreHandle * getHandle() override
return the underlying semaphore handle (implementation specific)
CountingSemaphore(U32 initial_count)
Constructor with initial count.
virtual ~CountingSemaphoreInterface()=default
default virtual destructor
Status waitTimeout(const Fw::TimeInterval &interval) override
wait with timeout
Status tryWait() override
non-blocking attempt to decrement the semaphore
virtual Status tryWait()=0
non-blocking attempt to decrement the semaphore
virtual Status waitTimeout(const Fw::TimeInterval &interval)=0
wait on the semaphore with a timeout
virtual Status post()=0
post (increment) the semaphore, potentially waking a waiting thread
Status wait() override
wait (decrement), blocking if count is zero
Status post() override
post (increment) the semaphore, potentially waking a waiting thread
virtual Status wait()=0
wait (decrement) the semaphore, blocking if count is zero
#define FW_ASSERT(...)
Definition: Assert.hpp:14
virtual CountingSemaphoreHandle * getHandle()=0
return the underlying semaphore handle (implementation specific)