Skip to content

Refactor concurrency policy traits handlers#8

Merged
11 commits merged intomainfrom
refactor-concurrency-policy-traits-handlers
Mar 20, 2026
Merged

Refactor concurrency policy traits handlers#8
11 commits merged intomainfrom
refactor-concurrency-policy-traits-handlers

Conversation

@FrozenLemonTee
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings March 19, 2026 10:56
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::atomic with policy::concurrency::{fenced, fenced_relaxed, fenced_acq_rel, fenced_seq_cst} and extend concurrency injection to carry std::memory_order.
  • Add concurrency “access handler” protocol/concepts and implement primitive load/store/compare_exchange via std::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_;
};
@FrozenLemonTee FrozenLemonTee closed this pull request by merging all changes into main in 8a014af Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants