![]() |
CommRaT 2.0.0
C++20 Real-Time Messaging Framework
|
Unified threading and synchronization abstractions for CommRaT. More...
#include <thread>#include <mutex>#include <shared_mutex>#include <condition_variable>#include <atomic>#include <functional>#include <string>#include <cstdint>#include <pthread.h>#include <sched.h>Go to the source code of this file.
Classes | |
| struct | commrat::ThreadConfig |
| Thread configuration. More... | |
| class | commrat::Thread |
| Thread wrapper with realtime support. More... | |
| class | commrat::Mutex |
| Mutex wrapper (future: realtime mutex support) More... | |
| class | commrat::SharedMutex |
| Shared mutex wrapper (reader-writer lock) More... | |
| class | commrat::ConditionVariable |
| Condition variable wrapper. More... | |
Namespaces | |
| namespace | commrat |
| CommRaT - Modern C++ Real-Time Communication Framework. | |
Macros | |
| #define | Synchronized(mutex) if (commrat::Lock _lock_##__LINE__{mutex}; true) |
| Scoped synchronized block - convenience wrapper. | |
| #define | ReadLocked(mutex) if (commrat::SharedLock _lock_##__LINE__{mutex}; true) |
| Scoped read-locked block (multiple readers) | |
| #define | WriteLocked(mutex) if (commrat::UniqueLockShared _lock_##__LINE__{mutex}; true) |
| Scoped write-locked block (exclusive writer) | |
Typedefs | |
| using | commrat::Lock = std::lock_guard< Mutex > |
| Scoped lock guard (RAII) | |
| using | commrat::UniqueLock = std::unique_lock< Mutex > |
| using | commrat::SharedLock = std::shared_lock< SharedMutex > |
| Scoped shared lock (RAII) - for readers. | |
| using | commrat::UniqueLockShared = std::unique_lock< SharedMutex > |
| Scoped unique lock (RAII) - for writers. | |
Enumerations | |
| enum class | commrat::ThreadPriority { commrat::IDLE = 0 , commrat::LOW = 10 , commrat::NORMAL = 50 , commrat::HIGH = 75 , commrat::REALTIME = 99 } |
| Thread priority levels. More... | |
| enum class | commrat::SchedulingPolicy { commrat::NORMAL , commrat::FIFO , commrat::ROUND_ROBIN , commrat::DEADLINE } |
| Thread scheduling policy. More... | |
Unified threading and synchronization abstractions for CommRaT.
Provides clean abstractions for:
Future: Can be switched to realtime thread APIs (pthread RT, SCHED_FIFO, etc.) without changing user code.
Definition in file threading.hpp.
| #define ReadLocked | ( | mutex | ) | if (commrat::SharedLock _lock_##__LINE__{mutex}; true) |
Scoped read-locked block (multiple readers)
Usage: SharedMutex mtx; ReadLocked(mtx) { // Read-only access (multiple readers OK) }
Definition at line 371 of file threading.hpp.
| #define Synchronized | ( | mutex | ) | if (commrat::Lock _lock_##__LINE__{mutex}; true) |
Scoped synchronized block - convenience wrapper.
Usage: Mutex mtx; Synchronized(mtx) { // Critical section }
Expands to: { Lock lock(mtx); ... }
Definition at line 359 of file threading.hpp.
| #define WriteLocked | ( | mutex | ) | if (commrat::UniqueLockShared _lock_##__LINE__{mutex}; true) |
Scoped write-locked block (exclusive writer)
Usage: SharedMutex mtx; WriteLocked(mutex) { // Exclusive write access }
Definition at line 383 of file threading.hpp.