F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
CountingSemaphore.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Os/Posix/CountingSemaphore.hpp
3 // \brief Posix definitions for Os::CountingSemaphore
4 // ======================================================================
5 #ifndef OS_POSIX_COUNTING_SEMAPHORE_HPP
6 #define OS_POSIX_COUNTING_SEMAPHORE_HPP
7 #include <semaphore.h>
9 
10 namespace Os {
11 namespace Posix {
12 namespace Semaphore {
13 
15  sem_t m_semaphore{};
16 };
17 
19  public:
20  explicit PosixCountingSemaphore(U32 initial_count);
21 
22  ~PosixCountingSemaphore() override;
23 
24  PosixCountingSemaphore(const PosixCountingSemaphore& other) = delete;
25 
27 
29 
31 
33 
35 
37 
38  private:
40 };
41 
42 } // namespace Semaphore
43 } // namespace Posix
44 } // namespace Os
45 #endif // OS_POSIX_COUNTING_SEMAPHORE_HPP
PosixCountingSemaphore::Status tryWait() override
non-blocking attempt to decrement the semaphore
CountingSemaphoreInterface & operator=(const CountingSemaphoreInterface &other)=delete
PosixCountingSemaphore::Status post() override
post (increment) the semaphore, potentially waking a waiting thread
PosixCountingSemaphore::Status wait() override
wait (decrement) the semaphore, blocking if count is zero
PosixCountingSemaphore::Status waitTimeout(const Fw::TimeInterval &interval) override
wait on the semaphore with a timeout
CountingSemaphoreHandle * getHandle() override
return the underlying semaphore handle (implementation specific)