|
Internal Interface Wrap
API reference
|
Cross-platform mutex and synchronization primitives with pluggable backend. More...
#include <atomic>#include <cstdint>Go to the source code of this file.
Classes | |
| struct | NullMutexBackend |
| No-op mutex backend – all operations compile to nothing. More... | |
| class | PlatformTime |
| class | PlatformMutexImpl< Backend > |
| Recursive mutex templated on a backend policy. More... | |
| class | PlatformSharedMutexImpl< Backend > |
| Reader-writer mutex using two regular mutexes + atomic counters. More... | |
| class | PlatformUniqueLock< Mutex > |
| RAII exclusive lock guard for any mutex with lock()/try_lock_for()/unlock(). More... | |
| class | PlatformSharedLock< SharedMutex > |
| RAII shared (reader) lock guard for any shared mutex. More... | |
Typedefs | |
| using | PlatformMutexActiveBackend = NullMutexBackend |
| Default: all mutex operations compile to nothing. | |
| using | PlatformMutex = PlatformMutexImpl< PlatformMutexActiveBackend > |
| Concrete recursive mutex using the active backend. | |
| using | PlatformSharedMutex = PlatformSharedMutexImpl< PlatformMutexActiveBackend > |
| Concrete reader-writer mutex using the active backend. | |
| using | PlatformMutexLockGuard = PlatformUniqueLock< PlatformMutex > |
| RAII exclusive lock guard for PlatformMutex. | |
| template<typename Mutex > | |
| using | PlatformLockGuard = PlatformUniqueLock< Mutex > |
| Generic RAII lock guard alias. | |
Cross-platform mutex and synchronization primitives with pluggable backend.
This header is FULLY SELF-CONTAINED within hf-internal-interface-wrap. It has NO external dependencies beyond C++ standard headers (<atomic>, <cstdint>).
=== BACKEND ARCHITECTURE ===
All mutex operations delegate to a compile-time Backend policy class. By default, the backend is NullMutexBackend – all operations are constexpr inline no-ops that the optimizer eliminates completely (zero code generated).
At the core/ layer (where hf-internal-interface-wrap and hf-utils-rtos-wrap are brought together), a "PlatformMutexBackend.h" configuration header may be placed on the include path. This header defines a concrete backend struct that delegates to the RTOS abstraction layer (OsAbstraction.h) for real mutex protection under FreeRTOS or another RTOS.
=== ZERO-OVERHEAD PRINCIPLE ===
When no backend config is found (standalone interface-wrap builds, host builds, MCU=NONE, RTOS=NONE), NullMutexBackend is used:
=== CUSTOMIZATION (for core/ layer or other consumers) ===
Create "PlatformMutexBackend.h" on the include path and:
Generic RAII lock guard alias.
Concrete recursive mutex using the active backend.
Default: all mutex operations compile to nothing.
RAII exclusive lock guard for PlatformMutex.
Concrete reader-writer mutex using the active backend.