F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
Mutex.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Os/Posix/Mutex.hpp
3 // \brief Posix definitions for Os::Mutex
4 // ======================================================================
5 #ifndef OS_POSIX_MUTEX_HPP
6 #define OS_POSIX_MUTEX_HPP
7 #include <pthread.h>
8 #include <Os/Mutex.hpp>
9 
10 namespace Os {
11 namespace Posix {
12 namespace Mutex {
13 
14 struct PosixMutexHandle : public MutexHandle {
15  pthread_mutex_t m_mutex_descriptor = PTHREAD_MUTEX_INITIALIZER;
16 };
17 
22 class PosixMutex : public MutexInterface {
23  public:
26  PosixMutex();
27 
30  ~PosixMutex() override;
31 
34  MutexHandle* getHandle() override;
35 
36  Status take() override;
37  Status release() override;
38 
39  private:
41  PosixMutexHandle m_handle;
42 };
43 
44 } // namespace Mutex
45 } // namespace Posix
46 } // namespace Os
47 #endif // OS_POSIX_MUTEX_HPP
Posix implementation of Os::Mutex.
Definition: Mutex.hpp:22
~PosixMutex() override
destructor
Definition: Mutex.cpp:31
PosixMutex()
constructor
Definition: Mutex.cpp:13
Status release() override
unlock the mutex and get return status
Definition: Mutex.cpp:41
MutexHandle * getHandle() override
return the underlying mutex handle (implementation specific)
Definition: Mutex.cpp:46
Status take() override
lock the mutex and get return status
Definition: Mutex.cpp:36
pthread_mutex_t m_mutex_descriptor
Definition: Mutex.hpp:15