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
null_mutex.h File Reference

Zero-cost semantic placeholder for mutex_like synchronization. More...

#include <chrono>
#include "jh/conceptual/mutex_like.h"

Go to the source code of this file.

Classes

struct  jh::typed::null_mutex_t
 Semantic placeholder for mutex_like types. More...

Namespaces

namespace  jh::typed
 Aggregated entry point for lightweight typing and semantic placeholder utilities.

Variables

null_mutex_t jh::typed::null_mutex
 Global constant instance of null_mutex_t.

Detailed Description

Zero-cost semantic placeholder for mutex_like synchronization.

Author
JeongHan-Bae <mastropseudo@gmail.com>

Defines jh::typed::null_mutex_t — a fully concept-compatible, zero-overhead dummy mutex used to satisfy jh::concepts::mutex_like and related locking concepts.

This type provides all standard locking interfaces (lock(), unlock(), try_lock(), lock_shared(), etc.) as pure no-ops. All try_* functions always return true.

This type exists only for generic compatibility with mutex_like concepts. It carries no runtime state and performs no synchronization.

You should never create separate instances of this type. Always use the global constant jh::typed::null_mutex instead.

Typical usage:

auto s = jh::safe_from("text", typed::null_mutex);
// returns std::shared_ptr<jh::immutable_str>
jh::sync::const_lock guard(typed::null_mutex); // No-op
Scope-based immutability barrier for mutex_like types.
Definition const_lock.h:99
atomic_str_ptr safe_from(std::string_view sv, M &mtx)
Creates a shared pointer to an immutable_str from a locked string view.
Definition immutable_str.h:1123
Version
1.3.x
Date
2025