The library describes a standard set of requirements for executors.
A type meeting the Executor
requirements embodies a set of rules
for determining how submitted function objects are to be executed.
A type X
meets the Executor
requirements if it
satisfies the requirements of CopyConstructible
(C++Std [copyconstructible])
and Destructible
(C++Std [destructible]), as well as the additional
requirements listed below.
No constructor, comparison operator, copy operation, move operation, swap
operation, or member functions context
, on_work_started
,
and on_work_finished
on these types shall exit via an exception.
The executor copy constructor, comparison operators, and other member functions defined in these requirements shall not introduce data races as a result of concurrent calls to those functions from different threads.
Let ctx
be the execution context returned by the executor's
context()
member function. An executor becomes invalid
when the first call to ctx.shutdown()
returns. The effect of
calling on_work_started
, on_work_finished
, dispatch
,
post
, or defer
on an invalid executor is undefined.
[Note: The copy constructor, comparison operators, and
context()
member function continue to remain valid until ctx
is destroyed. —end note]
In the table below, x1
and x2
denote (possibly
const) values of type X
, mx1
denotes an xvalue
of type X
, f
denotes a MoveConstructible
(C++Std [moveconstructible]) function object callable with zero arguments,
a
denotes a (possibly const) value of type A
meeting
the Allocator
requirements (C++Std [allocator.requirements]),
and u
denotes an identifier.
Table 14. Executor requirements
expression |
type |
assertion/note |
---|---|---|
|
Shall not exit via an exception. |
|
|
Shall not exit via an exception. |
|
|
|
Returns |
|
|
Same as |
|
|
Shall not exit via an exception. |
|
Shall not exit via an exception. |
|
|
Shall not exit via an exception. |
|
|
Effects: Creates an object |
|
|
Effects: Creates an object |