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

Aggregated header for inter-process communication primitives under jh::sync. More...

Go to the source code of this file.

Namespaces

namespace  jh::sync
 Aggregated entry point for synchronization and coordination facilities.
namespace  jh::sync::ipc
 Synchronous inter-process coordination primitives.

Detailed Description

Aggregated header for inter-process communication primitives under jh::sync.

This header collects all IPC-related synchronous primitives into a single entry point:

#include <jh/synchronous/ipc.h>

It includes and re-exports all IPC components under jh::sync::ipc, such as shared-memory synchronization and inter-process coordination utilities.

Included Components

  • ipc_limits — compile-time IPC capacity and name validation utilities.
  • process_mutex — basic inter-process mutex, functionally similar to std::timed_mutex; non-recursive and minimal, used as the fundamental synchronization primitive.
  • process_cond_var — condition variable for processes.
  • process_counter — atomic counter for process coordination.
  • process_shm_obj — shared memory allocator and container.
  • shared_process_mutex — engineering-grade reader-writer lock built on shared memory, conceptually similar to std::shared_timed_mutex but supporting reentrancy and privileged read-to-write promotion under elevated contexts.
  • process_launcher — process orchestration utilities.

Philosophy

Unlike Boost.Interprocess, which centralizes resource management within a managed shared memory segment, the jh::sync::ipc system implements compile-time named, process-independent primitives built directly on OS-level shared memory and semaphores.

Each primitive (mutex, condition, counter, shared memory) is a self-contained, globally addressable IPC object. No central allocator or parent process is required — all participants synchronize via shared OS namespaces.

This design enables decentralized, single-machine distributed coordination with compile-time safety and zero runtime registration. The system itself, not a supervising process, performs the scheduling. Daemons only perform minimal orchestration, reducing cognitive overhead.

Compile-time naming contract

All IPC primitives in jh::sync::ipc rely on a compile-time naming convention enforced by jh::sync::ipc::limits::valid_object_name.

  • Each synchronization object (e.g., semaphore, shared memory region, condition) is bound to a name known at compile time.
  • The name serves as the linkage contract between processes — identical template literals across binaries guarantee consistent mapping.
  • Invalid or conflicting names produce compile-time errors, ensuring namespace safety and deterministic inter-process behavior.
  • Names may be hardcoded or provided through macros at build time, but must be resolvable during compilation to ensure deterministic layout.

This model guarantees mapping consistency, eliminates runtime name collisions, and provides a static coordination topology — effectively compile-time declared IPC fabric.