Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 60 additions & 5 deletions source/exec.tex
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,12 @@
// \ref{exec.queries}, queries
struct @\libglobal{forwarding_query_t}@ { @\unspec@ };
struct @\libglobal{get_allocator_t}@ { @\unspec@ };
struct @\libglobal{get_scheduler_allocator_t}@ { @\unspec@ };
struct @\libglobal{get_stop_token_t}@ { @\unspec@ };

inline constexpr forwarding_query_t @\libglobal{forwarding_query}@{};
inline constexpr get_allocator_t @\libglobal{get_allocator}@{};
inline constexpr get_scheduler_allocator_t @\libglobal{get_scheduler_allocator}@{};
inline constexpr get_stop_token_t @\libglobal{get_stop_token}@{};

template<class T>
Expand Down Expand Up @@ -892,6 +894,30 @@
\tcode{forwarding_query(get_allocator)} is a core constant expression and
has value \tcode{true}.

\rSec2[exec.get.scheduler.allocator]{\tcode{get_scheduler_allocator}}

\pnum
\tcode{get_scheduler_allocator} asks a queryable object for an associated allocator to be used by a scheduler.

\pnum
The name \tcode{get_scheduler_allocator} denotes a query object.
For a subexpression \tcode{env},
\tcode{get_scheduler_allocator(env)} is expression-equivalent to
\tcode{\exposid{MANDATE-NOTHROW}(\exposid{AS-CONST}(env).query(get_scheduler_allocator))}
if that expression is well-formed,
otherwise it is expression-equivalent to
\tcode{\exposid{MANDATE-NOTHROW}(\allowbreak
\exposid{AS-CONST}(env).query(get_allocator))}.

\mandates
If the expression \tcode{get_scheduler_allocator(env)} is well-formed,
its type satisfies
\exposconceptx{simple-al\-locator}{simple-allocator}\iref{allocator.requirements.general}.

\pnum
\tcode{forwarding_query(get_scheduler_allocator)} is a core constant expression and
has value \tcode{true}.

\rSec2[exec.get.stop.token]{\tcode{get_stop_token}}

\pnum
Expand Down Expand Up @@ -7986,18 +8012,47 @@
\begin{itemdescr}
\pnum
\effects
Let \tcode{\placeholder{ev}} be the object \tcode{get_env(\exposid{rcvr})}.
Let \tcode{\placeholder{prom}} be the object \tcode{\exposid{handle}.promise()}.
Associates \tcode{\exposid{STATE}(\placeholder{prom})}, \tcode{\exposid{RCVR}(\placeholder{prom})}, and \tcode{\exposid{SCHED}(\placeholder{prom})}
Associates \tcode{\exposid{STATE}(\placeholder{prom})},
\tcode{\exposid{RCVR}(\placeholder{prom})},
and \tcode{\exposid{SCHED}(\placeholder{prom})}
with \tcode{*this} as follows:
\begin{itemize}
\item \tcode{\exposid{STATE}(\placeholder{prom})} is \tcode{*this}.
\item \tcode{\exposid{RCVR}(\placeholder{prom})} is \exposid{rcvr}.
\item \tcode{\exposid{SCHED}(\placeholder{prom})} is the object initialized
with \tcode{start_scheduler_type(get_start_scheduler(get_env(\exposid{rcvr})))}
if that expression is valid and \tcode{start_scheduler_type()} otherwise.
If neither of these expressions is valid, the program is ill-formed.
\item \tcode{\exposid{SCHED}(\placeholder{prom})} is an object initialized with
\begin{itemize}
\item if
\begin{codeblock}
same_as<start_scheduler_type, remove_cvref_t<decltype(get_start_scheduler(@\placeholder{ev}@))>>
\end{codeblock}
is \tcode{true}, \tcode{get_start_scheduler(\placeholder{ev})};
\item otherwise,
\begin{codeblock}
start_scheduler_type(get_start_scheduler(@\placeholder{ev}@), get_scheduler_allocator(@\placeholder{ev}@))
\end{codeblock}
if this expression is valid;
\item otherwise, \tcode{start_scheduler_type(get_start_scheduler(\placeholder{ev}))}
if this expression is valid;
\item otherwise, \tcode{start_scheduler_type(get_scheduler_allocator(\placeholder{ev}))}
if this expression is valid;
\item otherwise, \tcode{start_scheduler_type()} if this expression is valid;
\item otherwise, the program is ill-formed.
\end{itemize}
\end{itemize}

\pnum
Finally, invokes \tcode{\exposid{handle}.resume()}.

\pnum
\remarks
If \tcode{get_start_scheduler(get_env(\exposid{rcvr}))}
is a valid expression, then the result shall remain valid for
the duration of the asynchronous operation's lifetime.
If \tcode{get_scheduler_allocator(get_env(\exposid{rcvr}))}
is a valid expression, then the result shall remain valid for
the duration of the asynchronous operation's lifetime.
\end{itemdescr}

\indexlibrarymember{\exposid{get-stop-token}}{task::\exposid{state}}%
Expand Down
Loading