// the find
AlexeyAB/object_threadsafe
We make any object thread-safe and std::shared_mutex 10 times faster to achieve the speed of lock-free algorithms on >85% reads
A header-only C++ library that wraps any object in a mutex-backed smart pointer (`safe_ptr<>`) and provides a per-thread-slot shared mutex (`contention_free_shared_mutex`) that avoids false sharing on the reader path. Aimed at systems programmers who want read-heavy workloads to scale without rewriting data structures. The benchmarks show real gains in high-reader-count scenarios on multi-core hardware.
The `contention_free_shared_mutex` design is technically sound: each thread gets its own cache-line-aligned slot, so readers never bounce a shared counter — that's the actual reason `std::shared_mutex` falls apart at high core counts. The `safe_ptr` operator-> trick for automatic RAII locking is ergonomically clean and composes with existing STL containers without modification. The included benchmarks against libCDS give you a concrete reference point instead of synthetic microbenchmarks. Header-only distribution means zero build system integration cost.
Last commit was June 2022 — the repo is effectively unmaintained, which matters for a concurrency primitive where correctness bugs surface slowly. The `safe_ptr` operator-> convenience comes at a cost that isn't discussed: every member access takes a full lock, so compound operations (read-modify-write across two fields) are still racy unless you manually grab a `lock_guard` — the API makes it easy to write code that looks safe but isn't. The claimed '10x faster than std::shared_mutex' headline is hardware- and contention-profile-specific; the benchmark numbers were measured on specific server CPUs and the README doesn't caveat that at all. No sanitizer CI, no AddressSanitizer or ThreadSanitizer runs visible in the repo, which is a significant omission for concurrency code.