Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors the concurrency policy layer by replacing the prior atomic policy with a set of fenced* policies that inject configurable memory-order fences, and adds an explicit handler protocol for primitive load/store/CAS operations via concurrency policies.
Changes:
- Replace
policy::concurrency::atomicwithpolicy::concurrency::{fenced, fenced_relaxed, fenced_acq_rel, fenced_seq_cst}and extend concurrency injection to carrystd::memory_order. - Add concurrency “access handler” protocol/concepts and implement primitive
load/store/compare_exchangeviastd::atomic_ref-backed handlers. - Update tests, examples, and README to reflect the new concurrency policy names and semantics.
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 | Updates policy trait/concurrency handler tests for fenced* policies and verifies injected memory orders + access-handler availability. |
| tests/basic/test_operations.cpp | Renames atomic-policy tests to fenced-policy tests and adds coverage for primitive load/store/CAS under fenced policy. |
| src/primitive/impl.cppm | Adds primitive concurrency policy resolution and new load/store/compare_exchange APIs using concurrency access handlers. |
| src/policy/utility.cppm | Updates concurrency policy priority ordering to prefer fenced over none. |
| src/policy/impl.cppm | Introduces fenced* policy tags/traits and implements inject() + std::atomic_ref access handlers for these policies. |
| src/policy/handler.cppm | Extends concurrency injection with memory orders and adds handler access protocol/availability concepts. |
| src/operations/invoker.cppm | Threads injected memory orders through runtime fences (atomic_thread_fence(order)). |
| README.md | Updates documented concurrency policies and adds documentation + example for primitive concurrency access APIs. |
| examples/ex07_custom_policy.cpp | Updates custom policy example to set injected fence memory orders. |
| examples/ex05_concurrency_policy.cpp | Updates concurrency example to use fenced policy and demonstrates primitive load/store/CAS. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+294
to
+297
| static auto load(CommonRep const &value) noexcept -> CommonRep { | ||
| std::atomic_ref<CommonRep const> ref(value); | ||
| return ref.load(std::memory_order_seq_cst); | ||
| } |
Comment on lines
104
to
106
| private: | ||
| value_type value_; | ||
| }; |
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.