Init
This commit is contained in:
14
cppdraft/exec/sysctxrepl/general.md
Normal file
14
cppdraft/exec/sysctxrepl/general.md
Normal file
@@ -0,0 +1,14 @@
|
||||
[exec.sysctxrepl.general]
|
||||
|
||||
# 33 Execution control library [[exec]](./#exec)
|
||||
|
||||
## 33.16 Namespace system_context_replaceability [[exec.sysctxrepl]](exec.sysctxrepl#general)
|
||||
|
||||
### 33.16.1 General [exec.sysctxrepl.general]
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8432)
|
||||
|
||||
Facilities in the system_context_replaceability namespace
|
||||
allow users to replace the default implementation of parallel_scheduler[.](#1.sentence-1)
|
||||
198
cppdraft/exec/sysctxrepl/psb.md
Normal file
198
cppdraft/exec/sysctxrepl/psb.md
Normal file
@@ -0,0 +1,198 @@
|
||||
[exec.sysctxrepl.psb]
|
||||
|
||||
# 33 Execution control library [[exec]](./#exec)
|
||||
|
||||
## 33.16 Namespace system_context_replaceability [[exec.sysctxrepl]](exec.sysctxrepl#psb)
|
||||
|
||||
### 33.16.3 Class parallel_scheduler_backend [exec.sysctxrepl.psb]
|
||||
|
||||
namespace std::execution::system_context_replaceability {struct [parallel_scheduler_backend](#lib:parallel_scheduler_backend "33.16.3 Class parallel_scheduler_backend [exec.sysctxrepl.psb]") {virtual ~parallel_scheduler_backend() = default; virtual void schedule(receiver_proxy&, span<byte>) noexcept = 0; virtual void schedule_bulk_chunked(size_t, bulk_item_receiver_proxy&,
|
||||
span<byte>) noexcept = 0; virtual void schedule_bulk_unchunked(size_t, bulk_item_receiver_proxy&,
|
||||
span<byte>) noexcept = 0; };}
|
||||
|
||||
[ð](#lib:schedule,parallel_scheduler_backend)
|
||||
|
||||
`virtual void schedule(receiver_proxy& r, span<byte> s) noexcept = 0;
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8550)
|
||||
|
||||
*Preconditions*: The ends of
|
||||
the lifetimes of *this,
|
||||
the object referred to by r, and
|
||||
any storage referenced by s all happen after
|
||||
the beginning of the evaluation of
|
||||
the call to set_value, set_error, or set_done on r (see below)[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8561)
|
||||
|
||||
*Effects*: A derived class shall implement this function such that:
|
||||
|
||||
- [(2.1)](#2.1)
|
||||
|
||||
One of the following expressions is evaluated:
|
||||
* [(2.1.1)](#2.1.1)
|
||||
|
||||
r.set_value(), if no error occurs, and the work is successful;
|
||||
|
||||
* [(2.1.2)](#2.1.2)
|
||||
|
||||
r.set_error(eptr), if an error occurs,
|
||||
where eptr is an object of type exception_ptr;
|
||||
|
||||
* [(2.1.3)](#2.1.3)
|
||||
|
||||
r.set_stopped(), if the work is canceled[.](#2.1.sentence-1)
|
||||
|
||||
- [(2.2)](#2.2)
|
||||
|
||||
Any call to r.set_value() happens on
|
||||
an execution agent of the execution context represented by *this[.](#2.2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8581)
|
||||
|
||||
*Remarks*: The storage referenced by s may be used by *this as temporary storage
|
||||
for the duration of the operation launched by this call[.](#3.sentence-1)
|
||||
|
||||
[ð](#lib:schedule_bulk_chunked,parallel_scheduler_backend)
|
||||
|
||||
`virtual void schedule_bulk_chunked(size_t n, bulk_item_receiver_proxy& r,
|
||||
span<byte> s) noexcept = 0;
|
||||
`
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8595)
|
||||
|
||||
*Preconditions*: The ends of
|
||||
the lifetimes of *this,
|
||||
the object referred to by r, and
|
||||
any storage referenced by s all happen after
|
||||
the beginning of the evaluation of one of the expressions below[.](#4.sentence-1)
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8604)
|
||||
|
||||
*Effects*: A derived class shall implement this function such that:
|
||||
|
||||
- [(5.1)](#5.1)
|
||||
|
||||
Eventually, one of the following expressions is evaluated:
|
||||
* [(5.1.1)](#5.1.1)
|
||||
|
||||
r.set_value(), if no error occurs, and the work is successful;
|
||||
|
||||
* [(5.1.2)](#5.1.2)
|
||||
|
||||
r.set_error(eptr), if an error occurs,
|
||||
where eptr is an object of type exception_ptr;
|
||||
|
||||
* [(5.1.3)](#5.1.3)
|
||||
|
||||
r.set_stopped(), if the work is canceled[.](#5.1.sentence-1)
|
||||
|
||||
- [(5.2)](#5.2)
|
||||
|
||||
If r.execute(b, e) is called,
|
||||
then b and e are in the range [0, n] andb < e[.](#5.2.sentence-1)
|
||||
|
||||
- [(5.3)](#5.3)
|
||||
|
||||
For each i in [0, n),
|
||||
there is at most one call to r.execute(b, e) such that i is in the range [b, e)[.](#5.3.sentence-1)
|
||||
|
||||
- [(5.4)](#5.4)
|
||||
|
||||
If r.set_value() is called,
|
||||
then for each i in [0, n),
|
||||
there is exactly one call to r.execute(b, e) such that i is in the range [b, e)[.](#5.4.sentence-1)
|
||||
|
||||
- [(5.5)](#5.5)
|
||||
|
||||
All calls to execute on r happen before
|
||||
the call to either set_value, set_error, or set_stopped on r[.](#5.5.sentence-1)
|
||||
|
||||
- [(5.6)](#5.6)
|
||||
|
||||
All calls to execute and set_value on r are made
|
||||
on execution agents of the execution context represented by *this[.](#5.6.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8641)
|
||||
|
||||
*Remarks*: The storage referenced by s may be used by *this as temporary storage for the duration of the operation launched by this call[.](#6.sentence-1)
|
||||
|
||||
[ð](#lib:schedule_bulk_unchunked,parallel_scheduler_backend)
|
||||
|
||||
`virtual void schedule_bulk_unchunked(size_t n, bulk_item_receiver_proxy& r,
|
||||
span<byte> s) noexcept = 0;
|
||||
`
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8654)
|
||||
|
||||
*Preconditions*: The ends of
|
||||
the lifetimes of *this,
|
||||
the object referred to by r, and
|
||||
any storage referenced by s all happen after
|
||||
the beginning of the evaluation of one of the expressions below[.](#7.sentence-1)
|
||||
|
||||
[8](#8)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8663)
|
||||
|
||||
*Effects*: A derived class shall implement this function such that:
|
||||
|
||||
- [(8.1)](#8.1)
|
||||
|
||||
Eventually, one of the following expressions is evaluated:
|
||||
* [(8.1.1)](#8.1.1)
|
||||
|
||||
r.set_value(), if no error occurs, and the work is successful;
|
||||
|
||||
* [(8.1.2)](#8.1.2)
|
||||
|
||||
r.set_error(eptr), if an error occurs,
|
||||
where eptr is an object of type exception_ptr;
|
||||
|
||||
* [(8.1.3)](#8.1.3)
|
||||
|
||||
r.set_stopped(), if the work is canceled[.](#8.1.sentence-1)
|
||||
|
||||
- [(8.2)](#8.2)
|
||||
|
||||
If r.execute(b, e) is called,
|
||||
then b is in the range [0, n) ande is equal to b + 1[.](#8.2.sentence-1)
|
||||
For each i in [0, n),
|
||||
there is at most one call to r.execute(i, i + 1)[.](#8.2.sentence-2)
|
||||
|
||||
- [(8.3)](#8.3)
|
||||
|
||||
If r.set_value() is called,
|
||||
then for each i in [0, n),
|
||||
there is exactly one call to r.execute(i, i + 1)[.](#8.3.sentence-1)
|
||||
|
||||
- [(8.4)](#8.4)
|
||||
|
||||
All calls to execute on r happen before
|
||||
the call to either set_value, set_error, or set_stopped on r[.](#8.4.sentence-1)
|
||||
|
||||
- [(8.5)](#8.5)
|
||||
|
||||
All calls to execute and set_value on r are made
|
||||
on execution agents of the execution context represented by *this[.](#8.5.sentence-1)
|
||||
|
||||
[9](#9)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8697)
|
||||
|
||||
*Remarks*: The storage referenced by s may be used by *this as temporary storage for the duration of the operation launched by this call[.](#9.sentence-1)
|
||||
95
cppdraft/exec/sysctxrepl/query.md
Normal file
95
cppdraft/exec/sysctxrepl/query.md
Normal file
@@ -0,0 +1,95 @@
|
||||
[exec.sysctxrepl.query]
|
||||
|
||||
# 33 Execution control library [[exec]](./#exec)
|
||||
|
||||
## 33.16 Namespace system_context_replaceability [[exec.sysctxrepl]](exec.sysctxrepl#query)
|
||||
|
||||
### 33.16.2 query_parallel_scheduler_backend [exec.sysctxrepl.query]
|
||||
|
||||
[ð](#lib:query_parallel_scheduler_backend)
|
||||
|
||||
`shared_ptr<parallel_scheduler_backend> query_parallel_scheduler_backend();
|
||||
`
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8443)
|
||||
|
||||
query_parallel_scheduler_backend() returns
|
||||
the implementation object for a parallel scheduler[.](#1.sentence-1)
|
||||
|
||||
[2](#2)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8447)
|
||||
|
||||
*Returns*: A non-null shared pointer to an object
|
||||
that implements the parallel_scheduler_backend interface[.](#2.sentence-1)
|
||||
|
||||
[3](#3)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8452)
|
||||
|
||||
*Remarks*: This function is replaceable ([[dcl.fct.def.replace]](dcl.fct.def.replace#term.replaceable.function "9.6.5 Replaceable function definitions"))[.](#3.sentence-1)
|
||||
|
||||
namespace std::execution::system_context_replaceability {struct [receiver_proxy](#lib:receiver_proxy "33.16.2 query_parallel_scheduler_backend [exec.sysctxrepl.query]") {virtual ~receiver_proxy() = default; protected:virtual bool *query-env*(*unspecified*) noexcept = 0; // *exposition only*public:virtual void set_value() noexcept = 0; virtual void set_error(exception_ptr) noexcept = 0; virtual void set_stopped() noexcept = 0; template<class P, [*class-type*](execution.syn#concept:class-type "33.4 Header <execution> synopsis [execution.syn]") Query> optional<P> try_query(Query q) noexcept; }; struct [bulk_item_receiver_proxy](#lib:bulk_item_receiver_proxy "33.16.2 query_parallel_scheduler_backend [exec.sysctxrepl.query]") : receiver_proxy {virtual void execute(size_t, size_t) noexcept = 0; };}
|
||||
|
||||
[4](#4)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8480)
|
||||
|
||||
receiver_proxy represents a receiver
|
||||
that will be notified
|
||||
by the implementations of parallel_scheduler_backend to trigger the completion operations[.](#4.sentence-1)
|
||||
|
||||
bulk_item_receiver_proxy is derived from receiver_proxy and
|
||||
is used for bulk_chunked and bulk_unchunked customizations
|
||||
that will also receive notifications
|
||||
from implementations of parallel_scheduler_backend corresponding to different iterations[.](#4.sentence-2)
|
||||
|
||||
[ð](#itemdecl:2)
|
||||
|
||||
`template<class P, [class-type](execution.syn#concept:class-type "33.4 Header <execution> synopsis [execution.syn]") Query>
|
||||
optional<P> [try_query](#lib:try_query "33.16.2 query_parallel_scheduler_backend [exec.sysctxrepl.query]")(Query q) noexcept;
|
||||
`
|
||||
|
||||
[5](#5)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8497)
|
||||
|
||||
*Mandates*: P is a cv-unqualified non-array object type[.](#5.sentence-1)
|
||||
|
||||
[6](#6)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8501)
|
||||
|
||||
*Returns*: Let env be the environment of the receiver represented by *this[.](#6.sentence-1)
|
||||
|
||||
If
|
||||
|
||||
- [(6.1)](#6.1)
|
||||
|
||||
Query is not a member of an implementation-defined set
|
||||
of supported queries; or
|
||||
|
||||
- [(6.2)](#6.2)
|
||||
|
||||
P is not a member of an implementation-defined set
|
||||
of supported result types for Query; or
|
||||
|
||||
- [(6.3)](#6.3)
|
||||
|
||||
the expression q(env) is not well-formed or
|
||||
does not have type cv P,
|
||||
|
||||
then returns nullopt[.](#6.sentence-2)
|
||||
|
||||
Otherwise, returns q(env)[.](#6.sentence-3)
|
||||
|
||||
[7](#7)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L8519)
|
||||
|
||||
*Remarks*: get_stop_token_t is
|
||||
in the implementation-defined set of supported queries, andinplace_stop_token is a member
|
||||
of the implementation-defined set of supported result types
|
||||
for get_stop_token_t[.](#7.sentence-1)
|
||||
Reference in New Issue
Block a user