RTOS Wrapper
API reference
Loading...
Searching...
No Matches
Classes | Typedefs
RtosMutex.h File Reference

Cross-platform RTOS mutex and synchronization primitives. More...

#include "OsAbstraction.h"
#include "OsUtility.h"
#include <atomic>
#include <cstdint>

Go to the source code of this file.

Classes

class  RtosTime
 
class  RtosMutex
 
class  RtosSharedMutex
 
class  RtosUniqueLock< MutexT >
 
class  RtosSharedLock< SharedMutexT >
 

Typedefs

template<typename MutexT >
using RtosLockGuard = RtosUniqueLock< MutexT >
 Convenience alias for unique lock guard.
 
using MutexLockGuard = RtosUniqueLock< RtosMutex >
 Convenience alias for RtosMutex lock guard.
 

Detailed Description

Cross-platform RTOS mutex and synchronization primitives.

This header provides platform-agnostic mutex, lock guard, and timing utilities for use by all layers above the MCU implementations (handlers, managers, API). The implementation is built on OsAbstraction.h which provides the underlying RTOS-portable primitives, so this code works across any supported RTOS (FreeRTOS, ThreadX future, Zephyr future) and bare-metal targets.

This is the authoritative location for RtosMutex — handlers and managers should include this file (from hf-utils-rtos-wrap) rather than reaching into the internal interface-wrap layer.

Author
Nebiyu Tadesse
Date
2025
Note
Platform support includes ESP32 (FreeRTOS), STM32 (future), and RP2040 (future). Bare-metal no-op stubs are provided when no RTOS is selected (HF_RTOS_NONE).
RtosMutex and RtosSharedMutex members that call the RTOS are defined in src/RtosMutex.cpp, so code that locks a mutex never calls the RTOS mutex API itself. Build systems compile that file for every backend, HF_RTOS_NONE included.
Todo:
Add

Typedef Documentation

◆ MutexLockGuard

Convenience alias for RtosMutex lock guard.

◆ RtosLockGuard

template<typename MutexT >
using RtosLockGuard = RtosUniqueLock<MutexT>

Convenience alias for unique lock guard.