33 Execution control library [exec]

33.16 Namespace system_context_replaceability [exec.sysctxrepl]

33.16.3 Class parallel_scheduler_backend [exec.sysctxrepl.psb]

namespace std::execution::system_context_replaceability { struct parallel_scheduler_backend { 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; }; }
virtual void schedule(receiver_proxy& r, span<byte> s) noexcept = 0;
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.
Effects: A derived class shall implement this function such that:
  • One of the following expressions is evaluated:
    • r.set_value(), if no error occurs, and the work is successful;
    • r.set_error(eptr), if an error occurs, where eptr is an object of type exception_ptr;
    • r.set_stopped(), if the work is canceled.
  • Any call to r.set_value() happens on an execution agent of the execution context represented by *this.
Remarks: The storage referenced by s may be used by *this as temporary storage for the duration of the operation launched by this call.
virtual void schedule_bulk_chunked(size_t n, bulk_item_receiver_proxy& r, span<byte> s) noexcept = 0;
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.
Effects: A derived class shall implement this function such that:
  • Eventually, one of the following expressions is evaluated:
    • r.set_value(), if no error occurs, and the work is successful;
    • r.set_error(eptr), if an error occurs, where eptr is an object of type exception_ptr;
    • r.set_stopped(), if the work is canceled.
  • If r.execute(b, e) is called, then b and e are in the range [0, n) and b < e.
  • 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).
  • 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).
  • All calls to execute on r happen before the call to either set_value, set_error, or set_stopped on r.
  • All calls to execute and set_value on r are made on execution agents of the execution context represented by *this.
Remarks: The storage referenced by s may be used by *this as temporary storage for the duration of the operation launched by this call.
virtual void schedule_bulk_unchunked(size_t n, bulk_item_receiver_proxy& r, span<byte> s) noexcept = 0;
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.
Effects: A derived class shall implement this function such that:
  • Eventually, one of the following expressions is evaluated:
    • r.set_value(), if no error occurs, and the work is successful;
    • r.set_error(eptr), if an error occurs, where eptr is an object of type exception_ptr;
    • r.set_stopped(), if the work is canceled.
  • If r.execute(b, e) is called, then b is in the range [0, n) and e is equal to b + 1.
    For each i in [0, n), there is at most one call to r.execute(i, i + 1).
  • If r.set_value() is called, then for each i in [0, n), there is exactly one call to r.execute(i, i + 1).
  • All calls to execute on r happen before the call to either set_value, set_error, or set_stopped on r.
  • All calls to execute and set_value on r are made on execution agents of the execution context represented by *this.
Remarks: The storage referenced by s may be used by *this as temporary storage for the duration of the operation launched by this call.