F´ Flight Software - C/C++ Documentation
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/Mutex.hpp
3 // \brief public Os::Mutex interface and alias
4 //
5 // This header aggregates all definitions needed to use Os::Mutex:
6 // the interface, the configured alias, and the concrete delegate type.
7 //
8 // The includes below must appear in the order given: each depends on names
9 // defined by the one before it, so reordering them will fail to compile.
10 // The ordering constraints are:
11 //
12 // 1. config/OsSelection.hpp (CFG) defines the Os::Mutex type alias by
13 // forward-declaring a link-time delegate (e.g. DelegateMutex) or directly
14 // aliasing a concrete implementation (e.g. Va416x0Os::AtomicMutex::AtomicMutex).
15 // Must not include Os OSAL headers (they aren't yet defined).
16 // Should only be included in Os/RawTimeInterface.hpp,
17 // Os/MutexInterface.hpp, and Os/ConditionVariableInterface.hpp.
18 //
19 // 2. Os/MutexInterface.hpp (IF) includes CFG first, then defines
20 // MutexHandle, MutexInterface, and ScopeLock.
21 //
22 // 3. OS_MUTEX_HEADER (IMPL) is defined by CFG and points to the concrete
23 // implementation header. If using delegation, this points to
24 // Os/DelegateMutex.hpp. If using compile-time selection, it points
25 // directly to a platform-specific implementation (e.g. AtomicMutex.hpp).
26 //
27 // MutexInterface.hpp must precede OS_MUTEX_HEADER here,
28 // and CFG must never include either of them (that would form a cycle).
29 // ======================================================================
30 #ifndef Os_Mutex_hpp
31 #define Os_Mutex_hpp
32 
33 #include "Os/MutexInterface.hpp"
34 
35 // Validate that OS_MUTEX_HEADER was defined by config/OsSelection.hpp
36 #ifndef OS_MUTEX_HEADER
37 #error "OS_MUTEX_HEADER must be defined in config/OsSelection.hpp"
38 #endif
39 
40 #include OS_MUTEX_HEADER
41 
42 #endif // Os_Mutex_hpp