-
Notifications
You must be signed in to change notification settings - Fork 8
Affine on wording #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||||||
| --- | ||||||||||
| title: Scheduler Affinity | ||||||||||
| document: P3941R0 | ||||||||||
| date: 2025-12-14 | ||||||||||
| document: P3941R1 | ||||||||||
| date: 2026-01-14 | ||||||||||
| audience: | ||||||||||
| - Concurrency Working Group (SG1) | ||||||||||
| - Library Evolution Working Group (LEWG) | ||||||||||
|
|
@@ -31,6 +31,10 @@ meet its objective at run-time. | |||||||||
|
|
||||||||||
| # Change History | ||||||||||
|
|
||||||||||
| ## R1 | ||||||||||
|
|
||||||||||
| - added wording | ||||||||||
|
|
||||||||||
| ## R0 Initial Revision | ||||||||||
|
|
||||||||||
| # Overview of Changes | ||||||||||
|
|
@@ -495,6 +499,304 @@ resolution in this issue is incomplete). | |||||||||
| The name `affine_on` isn't great. It may be worth giving the | ||||||||||
| algorithm a better name. | ||||||||||
|
|
||||||||||
| # Wording Changes: TODO | ||||||||||
| # Wording Changes | ||||||||||
|
|
||||||||||
| ::: ednote | ||||||||||
| Change [exec.affine.on] to use only one parameter, require an | ||||||||||
| infallible scheduler from the receiver, and add a default implementation | ||||||||||
| which allows customization of `affine_on` for child senders: | ||||||||||
| ::: | ||||||||||
|
|
||||||||||
| [1]{.pnum} | ||||||||||
| `affine_on` adapts a sender into one that completes on a [specified | ||||||||||
| scheduler]{.rm}[receiver's scheduler]{.add}. If the algorithm | ||||||||||
| determines that the adapted sender already completes on the correct | ||||||||||
| scheduler it can avoid any scheduling operation. | ||||||||||
|
|
||||||||||
| [2]{.pnum} | ||||||||||
| The name `affine_on` denotes a pipeable sender adaptor object. For | ||||||||||
| [a ]{.add} subexpression[s sch and]{.rm} `sndr`, if [`decltype((sch))` | ||||||||||
| does not satisfy scheduler, or]{.rm} `decltype((sndr))` does not | ||||||||||
| satisfy sender, <code>affine_on(sndr[, sch]{.rm})</code> is ill-formed. | ||||||||||
|
|
||||||||||
| [3]{.pnum} | ||||||||||
| Otherwise, the expression <code>affine_on(sndr[, sch]{.rm})</code> | ||||||||||
| is expression-equivalent to: | ||||||||||
| <code>transform_sender(_get-domain-early_(sndr), _make-sender_(affine_on, | ||||||||||
| [sch]{.rm}[env<>()]{.add}, sndr))</code> except that `sndr` | ||||||||||
| is evaluated only once. | ||||||||||
|
|
||||||||||
| [4]{.pnum} | ||||||||||
| The exposition-only class template <code>_impls-for_</code> | ||||||||||
| ([exec.snd.expos]) is specialized for `affine_on_t` as follows: | ||||||||||
|
|
||||||||||
| ```c++ | ||||||||||
| namespace std::execution { | ||||||||||
| template<> | ||||||||||
| struct impls-for<affine_on_t> : default-impls { | ||||||||||
| static constexpr auto get-attrs = | ||||||||||
| [](const auto&@[ data]{.rm}]@, const auto& child) noexcept -> decltype(auto) { | ||||||||||
| return @[_JOIN-ENV_(_SCHED-ATTRS_(data),_FWD-ENV_(]{.rm}@get_env(child)@[))]{.rm}@; | ||||||||||
| }; | ||||||||||
| }; | ||||||||||
| } | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| :::{.add} | ||||||||||
| [?]{.pnum} | ||||||||||
| Let `sndr` and `ev` be subexpressions such that `Sndr` is | ||||||||||
| `decltype((sndr))`. If <code><i>sender-for</i><Sndr, | ||||||||||
| affine_on_t></code> is `false`, then the expression | ||||||||||
| `affine_on.transform_sender(sndr, ev)` is ill-formed; otherwise, | ||||||||||
| if otherwise, it is equal to: | ||||||||||
|
|
||||||||||
| ``` | ||||||||||
| auto&[_, _, child] = sndr; | ||||||||||
| using child_tag_t = tag_of_t<remove_cvref_t<decltype(child)>>; | ||||||||||
| if constexpr (requires(const child_tag_t& t){ t.affine_on(child, env); }) | ||||||||||
| return t.affine_on(child, env); | ||||||||||
|
Comment on lines
+556
to
+557
|
||||||||||
| if constexpr (requires(const child_tag_t& t){ t.affine_on(child, env); }) | |
| return t.affine_on(child, env); | |
| if constexpr (requires(const child_tag_t& t){ t.affine_on(child, ev); }) | |
| return t.affine_on(child, ev); |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mismatched backtick: there's a closing backtick at the end of the line that should be removed. The code block is properly closed on line 785.
| completion_signatures<set_value_t(), set_error_t(exception_ptr), set_stopped_t()>` | |
| completion_signatures<set_value_t(), set_error_t(exception_ptr), set_stopped_t()> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant phrase 'if otherwise' should be 'otherwise'. The text currently reads 'otherwise, if otherwise' which is duplicative.