tmp/tmpf02muxp7/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Counting Scope <a id="exec.scope.counting">[[exec.scope.counting]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::execution {
|
| 5 |
+
class counting_scope {
|
| 6 |
+
public:
|
| 7 |
+
struct token {
|
| 8 |
+
template<sender Sender>
|
| 9 |
+
sender auto wrap(Sender&& snd) const noexcept(see below);
|
| 10 |
+
bool try_associate() const noexcept;
|
| 11 |
+
void disassociate() const noexcept;
|
| 12 |
+
|
| 13 |
+
private:
|
| 14 |
+
counting_scope* scope; // exposition only
|
| 15 |
+
};
|
| 16 |
+
|
| 17 |
+
static constexpr size_t max_associations = implementation-defined;
|
| 18 |
+
|
| 19 |
+
counting_scope() noexcept;
|
| 20 |
+
counting_scope(counting_scope&&) = delete;
|
| 21 |
+
~counting_scope();
|
| 22 |
+
|
| 23 |
+
token get_token() noexcept;
|
| 24 |
+
void close() noexcept;
|
| 25 |
+
sender auto join() noexcept;
|
| 26 |
+
void request_stop() noexcept;
|
| 27 |
+
|
| 28 |
+
private:
|
| 29 |
+
size_t count; // exposition only
|
| 30 |
+
scope-state-type state; // exposition only
|
| 31 |
+
inplace_stop_source s_source; // exposition only
|
| 32 |
+
|
| 33 |
+
bool try-associate() noexcept; // exposition only
|
| 34 |
+
void disassociate() noexcept; // exposition only
|
| 35 |
+
|
| 36 |
+
template<class State>
|
| 37 |
+
bool start-join-sender(State& state) noexcept; // exposition only
|
| 38 |
+
};
|
| 39 |
+
}
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
`counting_scope` differs from `simple_counting_scope` by adding support
|
| 43 |
+
for cancellation. Unless specified below, the semantics of members of
|
| 44 |
+
`counting_scope` are the same as the corresponding members of
|
| 45 |
+
`simple_counting_scope`.
|
| 46 |
+
|
| 47 |
+
``` cpp
|
| 48 |
+
token get_token() noexcept;
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
*Returns:* An object `t` of type `counting_scope::token` such that
|
| 52 |
+
`t.`*`scope`*` == this` is `true`.
|
| 53 |
+
|
| 54 |
+
``` cpp
|
| 55 |
+
void request_stop() noexcept;
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
*Effects:* Equivalent to *`s_source`*`.request_stop()`.
|
| 59 |
+
|
| 60 |
+
*Remarks:* Calls to `request_stop` do not introduce data races.
|
| 61 |
+
|
| 62 |
+
``` cpp
|
| 63 |
+
template<sender Sender>
|
| 64 |
+
sender auto counting_scope::token::wrap(Sender&& snd) const
|
| 65 |
+
noexcept(is_nothrow_constructible_v<remove_cvref_t<Sender>, Sender>);
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
*Effects:* Equivalent to:
|
| 69 |
+
|
| 70 |
+
``` cpp
|
| 71 |
+
return stop-when(std::forward<Sender>(snd), scope->s_source.get_token());
|
| 72 |
+
```
|
| 73 |
+
|