Enhance concurrency strategy with traits, tests, and documentation#9
Merged
FrozenLemonTee merged 14 commits intomainfrom Mar 20, 2026
Merged
Conversation
…tations in concurrency policies
There was a problem hiding this comment.
Pull request overview
This PR updates the library’s concurrency strategy by replacing the previous atomic concurrency policy with a new fenced* family, extending the concurrency injection protocol to carry explicit memory orders, and adding primitive-level load/store/CAS support via concurrency handlers.
Changes:
- Replace
policy::concurrency::atomicwithpolicy::concurrency::{fenced, fenced_relaxed, fenced_acq_rel, fenced_seq_cst}and propagate memory-order-aware fence injection. - Add
primitive::load/store/compare_exchangeimplemented through the concurrency handler access protocol (backed bystd::atomic_refwhen supported). - Update tests, examples, and README documentation to cover the new policies and access protocol.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/basic/test_policies.cpp | Adds coverage for new fenced policy traits, memory-order injection, and handler access availability gates. |
| tests/basic/test_operations.cpp | Renames/updates concurrency tests from atomic to fenced and adds load/store/CAS tests (incl. concurrent CAS increments). |
| src/primitive/impl.cppm | Adds concurrency-policy resolution/validation and introduces primitive atomic-access APIs via policy handlers. |
| src/policy/utility.cppm | Updates concurrency priority list to prefer fenced over none. |
| src/policy/impl.cppm | Defines new concurrency policy tags/traits and implements fenced handlers + std::atomic_ref-based access specializations. |
| src/policy/handler.cppm | Extends concurrency::injection with memory orders and introduces the handler access protocol/availability concepts. |
| src/operations/invoker.cppm | Threads the injected memory orders into runtime fence application. |
| examples/ex07_custom_policy.cpp | Updates custom concurrency handler example to set the new injection memory orders. |
| examples/ex05_concurrency_policy.cpp | Updates demo from atomic to fenced and showcases primitive load/store/CAS usage. |
| README.md | Documents new concurrency policy set and adds a concurrency access API example. |
e8ed4e1 to
6e14d3d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.