JH-Toolkit v1.4.1
An engineering-oriented C++20 toolkit with duck-typed concepts, static design, async coroutines, and semantic containers — header-only, RTTI-free, and concurrency-friendly.
Loading...
Searching...
No Matches
jh::typed::null_mutex_t Struct Referencefinal

Semantic placeholder for mutex_like types. More...

#include <jh/typing/null_mutex.h>

Public Member Functions

void lock () noexcept
void unlock () noexcept
template<typename Rep, typename Period>
bool try_lock_for (const std::chrono::duration< Rep, Period > &) noexcept
template<typename Clock, typename Duration>
bool try_lock_until (const std::chrono::time_point< Clock, Duration > &) noexcept
void lock_shared () noexcept
void unlock_shared () noexcept
template<typename Rep, typename Period>
bool try_lock_shared_for (const std::chrono::duration< Rep, Period > &) noexcept
template<typename Clock, typename Duration>
bool try_lock_shared_until (const std::chrono::time_point< Clock, Duration > &) noexcept

Static Public Member Functions

static bool try_lock () noexcept
static bool try_lock_shared () noexcept

Detailed Description

Semantic placeholder for mutex_like types.

A zero-cost, fully concept-compatible dummy mutex. All locking functions are implemented as no-ops, and all try_* operations always return true.

This type serves as a semantic stand-in for real synchronization primitives in contexts where locking is structurally required but semantically unnecessary — for example, when thread safety is guaranteed by design or when the data is confined to a single thread.

Concept compatibility:

It is analogous in spirit to std::nullptr_t: the type exists for semantic consistency, but creating distinct instances is meaningless. Use the provided global constant jh::typed::null_mutex instead.

See also
jh::typed::null_mutex
jh::concepts::mutex_like
jh::sync::const_lock

The documentation for this struct was generated from the following file: