RWLEnvelope 0.0.0
Thread-safe envelope wrapper using reader-writer locks
Loading...
Searching...
No Matches
RWLEnvelope.hpp File Reference

Thread-safe envelope wrapper using reader-writer locks. More...

#include <functional>
#include <shared_mutex>
#include <tuple>
#include <utility>
#include <concepts>
#include <exception>
#include <type_traits>
Include dependency graph for RWLEnvelope.hpp:

Go to the source code of this file.

Classes

class  siddiqsoft::RWLEnvelope< ContainerType >
 Thread-safe envelope wrapper using reader-writer locks. More...

Concepts

concept  siddiqsoft::ObserveCallbackNoexcept
 Concept to enforce that callbacks do not throw exceptions (for const/read-only access).
concept  siddiqsoft::MutateCallbackNoexcept
 Concept to enforce that callbacks do not throw exceptions (for mutable access).

Detailed Description

Thread-safe envelope wrapper using reader-writer locks.

RWLEnvelope provides a simple, convenient envelope-access model for thread-safe access to objects using reader-writer locks. It wraps a type T with std::shared_mutex to enable safe concurrent read and exclusive write access patterns.

Requirements

  • C++ Standard: C++20 or later (requires C++20 concepts support)
  • Required Headers: <shared_mutex>, <functional>, <tuple>, <utility>, <concepts>
  • Compiler Support: Must support [[nodiscard]] attribute and C++20 concepts
  • Optional: nlohmann/json library for JSON serialization support

Quick Start

data.observe([](const auto& m) noexcept { return m.find("key") != m.end(); });
data.mutate([](auto& m) noexcept { m["key"] = 42; });
Thread-safe envelope wrapper using reader-writer locks.

Definition in file RWLEnvelope.hpp.

Macro Definition Documentation

◆ RWLENVELOPE_HPP

#define RWLENVELOPE_HPP

Definition at line 61 of file RWLEnvelope.hpp.