[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)
