The native C/C++ side of Hexa.NET.Utilities, providing low-level synchronization primitives with a C-compatible API for P/Invoke interop from .NET.
- ReaderWriterLock — A high-performance, lock-free reader-writer lock built on C++20 atomics with:
- Multiple concurrent readers
- Exclusive writer access
- Writer fairness (writers are not starved by incoming readers)
- Try-lock variants for non-blocking acquisition
- C-compatible ABI for use from C or via P/Invoke
- CMake 3.20 or later
- A C++20-capable compiler (GCC, Clang, or MSVC)
- C99 compiler support
cmake -B build -DBUILD_SHARED_LIBS=ON
cmake --build buildTo build as a static library:
cmake -B build -DBUILD_SHARED_LIBS=OFF
cmake --build buildcmake --install buildThis installs the library to lib/ and headers to include/.
include/
common.h — Export macros and calling convention definitions
ReaderWriterLock.h — ReaderWriterLock C API
utils.h — Umbrella header (includes all public headers)
src/
ReaderWriterLock.cpp — C++20 atomic-based implementation
CMakeLists.txt
MIT License — Copyright (c) 2024 Juna Meinhold. See LICENSE.txt for details.