{"id":21327876,"url":"https://github.com/siddiqsoft/rwlcontainer","last_synced_at":"2026-06-28T07:01:25.402Z","repository":{"id":142736450,"uuid":"388622988","full_name":"SiddiqSoft/rwlcontainer","owner":"SiddiqSoft","description":"Small thread-safe read-writer locked container support class.","archived":false,"fork":false,"pushed_at":"2026-06-27T23:02:22.000Z","size":176,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-27T23:19:23.058Z","etag":null,"topics":["container","cpp20","header-only-library","nuget","reader-writer","threadsafe","waitable-queue"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SiddiqSoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-07-22T23:22:12.000Z","updated_at":"2026-06-27T21:42:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"c763fff0-3005-4d1d-9a79-eca9d7a5d3b2","html_url":"https://github.com/SiddiqSoft/rwlcontainer","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"purl":"pkg:github/SiddiqSoft/rwlcontainer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiddiqSoft%2Frwlcontainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiddiqSoft%2Frwlcontainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiddiqSoft%2Frwlcontainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiddiqSoft%2Frwlcontainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SiddiqSoft","download_url":"https://codeload.github.com/SiddiqSoft/rwlcontainer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SiddiqSoft%2Frwlcontainer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34880189,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-28T02:00:05.809Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["container","cpp20","header-only-library","nuget","reader-writer","threadsafe","waitable-queue"],"created_at":"2024-11-21T21:20:16.444Z","updated_at":"2026-06-28T07:01:25.383Z","avatar_url":"https://github.com/SiddiqSoft.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"RWLContainer : Reader-writer protected containers\n-------------------------------------------\n\n[![Build Status](https://dev.azure.com/siddiqsoft/siddiqsoft/_apis/build/status/SiddiqSoft.rwlcontainer?branchName=main)](https://dev.azure.com/siddiqsoft/siddiqsoft/_build/latest?definitionId=8\u0026branchName=main)\n![](https://img.shields.io/nuget/v/SiddiqSoft.RWLContainer)\n![](https://img.shields.io/github/v/tag/SiddiqSoft/RWLContainer)\n![](https://img.shields.io/azure-devops/tests/siddiqsoft/siddiqsoft/8)\n![](https://img.shields.io/azure-devops/coverage/siddiqsoft/siddiqsoft/8)\n\n# Overview\n\nThis library provides convenient, production-ready wrappers around C++20 standard library synchronization primitives:\n\n- **RWLContainer**: A reader-writer lock protected dictionary that wraps `std::unordered_map` with `std::shared_mutex` for safe concurrent access\n- **WaitableQueue**: A thread-safe queue that augments `std::queue` with `std::shared_mutex` and `std::counting_semaphore` for efficient producer-consumer patterns\n\nThese classes eliminate boilerplate synchronization code and provide a simple, type-safe API for common concurrent programming scenarios.\n\n## Requirements\n\n- C++20 or later\n- [`\u003cshared_mutex\u003e`](https://en.cppreference.com/w/cpp/thread/shared_mutex) and [`\u003cmutex\u003e`](https://en.cppreference.com/w/cpp/thread/mutex) support\n- CMake 3.20+\n\n## Platform Support\n\nTested and built on:\n- **Windows** (Visual Studio 2022)\n- **Linux** (Fedora)\n- **macOS**\n\nAll platforms are tested in the CI/CD pipeline with comprehensive test coverage.\n\n## Testing\n\n- Unit tests using Google Test (gtest)\n- Code coverage reporting (Linux builds)\n- Automated testing on all supported platforms via Azure Pipelines\n- Stress testing included in test suite\n\n### Known Test Behavior\n\n**ConcurrentScanAndWrite Test**: This stress test exercises concurrent scanning and writing operations on the RWLContainer. Due to platform-specific differences in `std::shared_mutex` implementations:\n\n- **Linux (x86_64 and ARM64)**: The test includes a timeout mechanism (100ms) to prevent potential deadlocks. The scan callback will exit early if it exceeds the timeout, allowing the test to complete successfully.\n- **Windows (ARM64)** and **macOS**: The test runs without timeout restrictions and completes normally without deadlock issues.\n\nThis difference is due to variations in how different platforms implement reader-writer lock fairness and priority inversion handling. The timeout mechanism ensures the test remains robust across all platforms while still validating the thread-safety of concurrent operations.\n\n**WaitUntilEmptyTightLoopContention Test**: This stress test for WaitableQueue exercises tight-loop contention between multiple threads calling `waitUntilEmpty()` while concurrent push/pop operations occur. Due to platform-specific differences in `std::shared_mutex` implementations:\n\n- **Linux (x86_64 and ARM64)**: The test is skipped or may experience deadlocks due to lock fairness issues under extreme contention. The tight loop with minimal timeouts (1ms) can cause priority inversion on Linux's shared_mutex implementation.\n- **Windows (ARM64)** and **macOS**: The test runs without issues and completes normally, demonstrating robust handling of concurrent wait and mutation operations.\n\nThis difference reflects variations in how different platforms prioritize reader vs. writer threads in shared_mutex implementations. The library's core functionality remains thread-safe on all platforms; this test specifically stresses an edge case that manifests differently across platforms.\n\n## Versioning\n\nUses [GitVersion](https://gitversion.net/) for semantic versioning (`MAJOR.MINOR.PATCH`). Version is automatically determined from git history.\n\n# API Documentation\n\nFor detailed API documentation, method signatures, and comprehensive examples, see [API.md](API.md).\n\n# Usage\n\n- Use the nuget [SiddiqSoft.RWLContainer](https://www.nuget.org/packages/SiddiqSoft.RWLContainer/)\n- Use CPM to integrate into your CMake project\n\n## Quick Example\n\n```cpp\n#include \"gtest/gtest.h\"\n#include \"nlohmann/json.hpp\"\n#include \"siddiqsoft/RWLContainer.hpp\"\n\nTEST(examples, Example1)\n{\n    try\n    {\n        siddiqsoft::RWLContainer\u003cstd::string, std::string\u003e myContainer;\n\n        auto item = myContainer.add(\"foo\", \"bar\");\n        ASSERT_TRUE(item);\n        EXPECT_EQ(\"bar\", *item);\n    }\n    catch (...)\n    {\n        EXPECT_TRUE(false); // if we throw then the test fails.\n    }\n}\n```\n\n\u003csmall align=\"right\"\u003e\n\n\u0026copy; 2021 Siddiq Software LLC. All rights reserved.\n\n\u003c/small\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddiqsoft%2Frwlcontainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiddiqsoft%2Frwlcontainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiddiqsoft%2Frwlcontainer/lists"}