68 lines
3.0 KiB
Markdown
68 lines
3.0 KiB
Markdown
[exec.opstate]
|
||
|
||
# 33 Execution control library [[exec]](./#exec)
|
||
|
||
## 33.8 Operation states [exec.opstate]
|
||
|
||
### [33.8.1](#general) General [[exec.opstate.general]](exec.opstate.general)
|
||
|
||
[1](#general-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L1273)
|
||
|
||
The [operation_state](#concept:operation_state "33.8.1 General [exec.opstate.general]") concept defines
|
||
the requirements of an operation state type ([[exec.async.ops]](exec.async.ops "33.3 Asynchronous operations"))[.](#general-1.sentence-1)
|
||
|
||
namespace std::execution {template<class O>concept [operation_state](#concept:operation_state "33.8.1 General [exec.opstate.general]") =[derived_from](concept.derived#concept:derived_from "18.4.3 Concept derived_from [concept.derived]")<typename O::operation_state_concept, operation_state_t> &&requires (O& o) { start(o); };}
|
||
|
||
[2](#general-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L1287)
|
||
|
||
If an [operation_state](#concept:operation_state "33.8.1 General [exec.opstate.general]") object is destroyed
|
||
during the lifetime of its asynchronous operation ([[exec.async.ops]](exec.async.ops "33.3 Asynchronous operations")),
|
||
the behavior is undefined[.](#general-2.sentence-1)
|
||
|
||
[*Note [1](#general-note-1)*:
|
||
|
||
The [operation_state](#concept:operation_state "33.8.1 General [exec.opstate.general]") concept does not impose requirements
|
||
on any operations other than destruction and start,
|
||
including copy and move operations[.](#general-2.sentence-2)
|
||
|
||
Invoking any such operation on an object
|
||
whose type models [operation_state](#concept:operation_state "33.8.1 General [exec.opstate.general]") can lead to undefined behavior[.](#general-2.sentence-3)
|
||
|
||
â *end note*]
|
||
|
||
[3](#general-3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L1299)
|
||
|
||
The program is ill-formed
|
||
if it performs a copy or move construction or assignment operation on
|
||
an operation state object created by connecting a library-provided sender[.](#general-3.sentence-1)
|
||
|
||
### [33.8.2](#start) execution::start [[exec.opstate.start]](exec.opstate.start)
|
||
|
||
[1](#start-1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L1306)
|
||
|
||
The name start denotes a customization point object
|
||
that starts ([[exec.async.ops]](exec.async.ops "33.3 Asynchronous operations"))
|
||
the asynchronous operation associated with the operation state object[.](#start-1.sentence-1)
|
||
|
||
For a subexpression op,
|
||
the expression start(op) is ill-formed
|
||
if op is an rvalue[.](#start-1.sentence-2)
|
||
|
||
Otherwise, it is expression-equivalent to*MANDATE-NOTHROW*(op.start())[.](#start-1.sentence-3)
|
||
|
||
[2](#start-2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/exec.tex#L1316)
|
||
|
||
If op.start() does not start ([[exec.async.ops]](exec.async.ops "33.3 Asynchronous operations"))
|
||
the asynchronous operation associated with the operation state op,
|
||
the behavior of calling start(op) is undefined[.](#start-2.sentence-1)
|