Skip to content

Commit 74e70d2

Browse files
refactor: Impl concurrency::handler for concurrency::none
1 parent 8135abc commit 74e70d2

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

src/policy/impl.cppm

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,33 @@ struct concurrency::handler<concurrency::none, OpTag, CommonRep, ErrorPayload> {
239239
}
240240
};
241241

242+
template <typename CommonRep, typename ErrorPayload>
243+
struct concurrency::handler<concurrency::none, void, CommonRep, ErrorPayload> {
244+
static constexpr bool enabled = true;
245+
using injection_type = concurrency::injection;
246+
using result_type = std::expected<CommonRep, ErrorPayload>;
247+
248+
static constexpr auto load(CommonRep const &value) noexcept -> CommonRep {
249+
return value;
250+
}
251+
252+
static constexpr auto store(CommonRep &value, CommonRep desired) noexcept
253+
-> void {
254+
value = desired;
255+
}
256+
257+
static constexpr auto compare_exchange(CommonRep &value, CommonRep &expected,
258+
CommonRep desired) noexcept -> bool {
259+
if (value != expected) {
260+
expected = value;
261+
return false;
262+
}
263+
264+
value = desired;
265+
return true;
266+
}
267+
};
268+
242269
template <operations::operation OpTag, typename CommonRep,
243270
typename ErrorPayload>
244271
struct concurrency::handler<concurrency::fenced, OpTag, CommonRep,

0 commit comments

Comments
 (0)