Skip to content

Commit a93a451

Browse files
committed
execution: P3149R11 counting_scope(#1510)
1 parent 4fbde58 commit a93a451

File tree

20 files changed

+576
-16
lines changed

20 files changed

+576
-16
lines changed

reference/execution/execution/counting_scope.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,29 @@ namespace std::execution {
1414
`counting_scope`は、停止要求を作成可能なカウント式の非同期スコープを表現する。
1515
1616
17+
クラス動作説明用のメンバ変数として下記を保持する。詳細仕様は[`simple_counting_scope`](simple_counting_scope.md)を参照。
18+
19+
- `count` : `size_t`型の関連付けカウント値
20+
- `state` : `scope-state-type`列挙型(後述)の状態
21+
- `s_source` : [`inplace_stop_source`](/reference/stop_token/inplace_stop_source.md)型の停止要求管理オブジェクト
22+
23+
1724
## メンバ関数
1825
1926
| 名前 | 説明 | 対応バージョン |
2027
|------|------|----------------|
21-
| [`(constructor)`](counting_scope/op_constructor.md.nolink) | コンストラクタ | C++26 |
22-
| [`(destructor)`](counting_scope/op_destructor.md.nolink) | デストラクタ | C++26 |
23-
| [`get_token`](counting_scope/get_token.md.nolink) | 非同期スコープトークンを取得 | C++26 |
24-
| [`close`](counting_scope/close.md.nolink) | 非同期スコープを閉じる | C++26 |
25-
| [`join`](counting_scope/join.md.nolink) | 非同期スコープを合流する[Sender](sender.md)取得 | C++26 |
26-
| [`request_stop`](counting_scope/request_stop.md.nolink) | 停止要求を行う | C++26 |
28+
| [`(constructor)`](counting_scope/op_constructor.md) | コンストラクタ | C++26 |
29+
| [`(destructor)`](counting_scope/op_destructor.md) | デストラクタ | C++26 |
30+
| [`get_token`](counting_scope/get_token.md) | 非同期スコープトークンを取得 | C++26 |
31+
| [`close`](counting_scope/close.md) | 非同期スコープを閉じる | C++26 |
32+
| [`join`](counting_scope/join.md) | 非同期スコープを合流する[Sender](sender.md)取得 | C++26 |
33+
| [`request_stop`](counting_scope/request_stop.md) | 停止要求を作成する | C++26 |
2734
2835
## メンバ型
2936
3037
| 名前 | 説明 | 対応バージョン |
3138
|------|------|----------------|
32-
| [`token`](counting_scope/token.md.nolink) | 非同期スコープトークン型 | C++26 |
39+
| [`token`](counting_scope/token.md) | 非同期スコープトークン型 | C++26 |
3340
3441
## 静的メンバ変数
3542
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# close
2+
* execution[meta header]
3+
* std::execution[meta namespace]
4+
* counting_scope[meta class]
5+
* function[meta id-type]
6+
* cpp26[meta cpp]
7+
8+
```cpp
9+
void close() noexcept;
10+
```
11+
12+
## 概要
13+
非同期スコープを閉じる。
14+
15+
16+
## 効果
17+
説明用のメンバ変数`state`に応じて、
18+
19+
- `unused`のとき、`state``unused-and-closed`に変更する。
20+
- `open`のとき、`state``closed`に変更する。
21+
- `open-and-joining`のとき、`state``closed-and-joining`に変更する。
22+
- それ以外のとき、何もしない。
23+
24+
25+
## 事後条件
26+
`*this`に対する後続の[`try-associate`](try-associate.md)`false`を返す。
27+
28+
29+
## 例外
30+
投げない
31+
32+
33+
## バージョン
34+
### 言語
35+
- C++26
36+
37+
### 処理系
38+
- [Clang](/implementation.md#clang): ??
39+
- [GCC](/implementation.md#gcc): ??
40+
- [ICC](/implementation.md#icc): ??
41+
- [Visual C++](/implementation.md#visual_cpp): ??
42+
43+
44+
## 参照
45+
- [P3149R11 `async_scope` - Creating scopes for non-sequential concurrency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3149r11.html)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# disassociate
2+
* execution[meta header]
3+
* std::execution[meta namespace]
4+
* counting_scope[meta class]
5+
* function[meta id-type]
6+
* cpp26[meta cpp]
7+
8+
```cpp
9+
void disassociate() noexcept; // exposition only
10+
```
11+
12+
## 概要
13+
非同期スコープとの関連付けを解除する、説明専用のメンバ関数。
14+
非同期トークン型[`token`](token.md)[`disassociate`](token/disassociate.md)メンバ動作を定義する。
15+
16+
17+
## 事前条件
18+
説明用のメンバ変数`count``0`より大きい。
19+
20+
21+
## 効果
22+
`count`をデクリメントする。
23+
デクリメント後の`count == 0`、かつ説明用のメンバ変数`state``open-and-joining`または`closed-and-joining`のとき、`state``joined`に変更し、`*this`に登録された全てのオブジェクトで`complete()`を呼び出す。
24+
25+
26+
## 例外
27+
投げない
28+
29+
30+
## バージョン
31+
### 言語
32+
- C++26
33+
34+
### 処理系
35+
- [Clang](/implementation.md#clang): ??
36+
- [GCC](/implementation.md#gcc): ??
37+
- [ICC](/implementation.md#icc): ??
38+
- [Visual C++](/implementation.md#visual_cpp): ??
39+
40+
41+
## 参照
42+
- [P3149R11 `async_scope` - Creating scopes for non-sequential concurrency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3149r11.html)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# get_token
2+
* execution[meta header]
3+
* std::execution[meta namespace]
4+
* counting_scope[meta class]
5+
* function[meta id-type]
6+
* cpp26[meta cpp]
7+
8+
```cpp
9+
token get_token() noexcept;
10+
```
11+
* token[link token.md]
12+
13+
## 概要
14+
非同期スコープの[非同期スコープトークン](token.md)を取得する。
15+
16+
17+
## 戻り値
18+
[`counting_scope::token`](token.md)型で`t.scope == this`となるオブジェクト`t`を返す。
19+
20+
21+
## 例外
22+
投げない
23+
24+
25+
## バージョン
26+
### 言語
27+
- C++26
28+
29+
### 処理系
30+
- [Clang](/implementation.md#clang): ??
31+
- [GCC](/implementation.md#gcc): ??
32+
- [ICC](/implementation.md#icc): ??
33+
- [Visual C++](/implementation.md#visual_cpp): ??
34+
35+
36+
## 参照
37+
- [P3149R11 `async_scope` - Creating scopes for non-sequential concurrency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3149r11.html)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# join
2+
* execution[meta header]
3+
* std::execution[meta namespace]
4+
* counting_scope[meta class]
5+
* function[meta id-type]
6+
* cpp26[meta cpp]
7+
8+
```cpp
9+
sender auto join() noexcept;
10+
```
11+
* sender[link ../sender.md]
12+
13+
## 概要
14+
非同期スコープを合流する[Sender](../sender.md)を取得する。
15+
16+
17+
## 戻り値
18+
[`make-sender`](../make-sender.md)`(`[`scope-join-t`](../simple_counting_scope.md)`(), this)`
19+
20+
21+
## 例外
22+
投げない
23+
24+
25+
## バージョン
26+
### 言語
27+
- C++26
28+
29+
### 処理系
30+
- [Clang](/implementation.md#clang): ??
31+
- [GCC](/implementation.md#gcc): ??
32+
- [ICC](/implementation.md#icc): ??
33+
- [Visual C++](/implementation.md#visual_cpp): ??
34+
35+
36+
## 参照
37+
- [P3149R11 `async_scope` - Creating scopes for non-sequential concurrency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3149r11.html)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# コンストラクタ
2+
* execution[meta header]
3+
* std::execution[meta namespace]
4+
* counting_scope[meta class]
5+
* function[meta id-type]
6+
* cpp26[meta cpp]
7+
8+
```cpp
9+
counting_scope() noexcept; // (1)
10+
counting_scope(counting_scope&&) = delete; // (2)
11+
```
12+
13+
## 概要
14+
- (1): デフォルトコンストラクタ
15+
- (2): ムーブコンストラクタ。ムーブ不可
16+
17+
18+
## 事後条件
19+
(1) 説明用のメンバ変数`count`は`0`、`state`は`unused`となる。
20+
21+
22+
## 例外
23+
投げない
24+
25+
26+
## バージョン
27+
### 言語
28+
- C++26
29+
30+
### 処理系
31+
- [Clang](/implementation.md#clang): ??
32+
- [GCC](/implementation.md#gcc): ??
33+
- [ICC](/implementation.md#icc): ??
34+
- [Visual C++](/implementation.md#visual_cpp): ??
35+
36+
37+
## 参照
38+
- [P3149R11 `async_scope` - Creating scopes for non-sequential concurrency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3149r11.html)
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# デストラクタ
2+
* execution[meta header]
3+
* std::execution[meta namespace]
4+
* counting_scope[meta class]
5+
* function[meta id-type]
6+
* cpp26[meta cpp]
7+
8+
```cpp
9+
~counting_scope();
10+
```
11+
12+
## 概要
13+
デストラクタ
14+
15+
16+
## 効果
17+
説明用のメンバ変数`state``joined`, `unused`, `unused-and-closed`のいずれでもなければ、[`terminate`](/reference/exception/terminate.md)を呼び出す。
18+
そうでなければ、何もしない。
19+
20+
21+
## バージョン
22+
### 言語
23+
- C++26
24+
25+
### 処理系
26+
- [Clang](/implementation.md#clang): ??
27+
- [GCC](/implementation.md#gcc): ??
28+
- [ICC](/implementation.md#icc): ??
29+
- [Visual C++](/implementation.md#visual_cpp): ??
30+
31+
32+
## 参照
33+
- [P3149R11 `async_scope` - Creating scopes for non-sequential concurrency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3149r11.html)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# request_stop
2+
* execution[meta header]
3+
* std::execution[meta namespace]
4+
* counting_scope[meta class]
5+
* function[meta id-type]
6+
* cpp26[meta cpp]
7+
8+
```cpp
9+
void request_stop() noexcept;
10+
```
11+
12+
## 概要
13+
非同期スコープ上で停止要求を作成する。
14+
15+
16+
## 効果
17+
`s_source.`[`request_stop()`](/reference/stop_token/inplace_stop_source/request_stop.md)
18+
19+
20+
## 例外
21+
投げない
22+
23+
24+
## 備考
25+
`request_stop`の呼び出しはデータ競合を引き起こさない。
26+
27+
28+
## バージョン
29+
### 言語
30+
- C++26
31+
32+
### 処理系
33+
- [Clang](/implementation.md#clang): ??
34+
- [GCC](/implementation.md#gcc): ??
35+
- [ICC](/implementation.md#icc): ??
36+
- [Visual C++](/implementation.md#visual_cpp): ??
37+
38+
39+
## 参照
40+
- [P3149R11 `async_scope` - Creating scopes for non-sequential concurrency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3149r11.html)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# start-join-sender
2+
* execution[meta header]
3+
* std::execution[meta namespace]
4+
* counting_scope[meta class]
5+
* function template[meta id-type]
6+
* cpp26[meta cpp]
7+
8+
```cpp
9+
template<class State>
10+
bool start-join-sender(State& st) noexcept; // exposition only
11+
```
12+
13+
## 概要
14+
合流[Sender](../sender.md)を開始する、説明専用のメンバ関数。
15+
[`join`](join.md)メンバ関数が返す合流Sender動作を定義する。
16+
17+
18+
## 効果
19+
説明用のメンバ変数`state`に応じて、
20+
21+
- `unused`, `unused-and-closed`, `joined`のとき、`state``joined`に変更して`true`を返す。
22+
- `open`, `open-and-joining`のとき、`state``open-and-joining`に変更し、`*this``st`を登録して`false`を返す。
23+
- `closed`, `closed-and-joining`のとき、`state``closed-and-joining`に変更し、`*this``st`を登録して`false`を返す。
24+
25+
26+
## 例外
27+
投げない
28+
29+
30+
## バージョン
31+
### 言語
32+
- C++26
33+
34+
### 処理系
35+
- [Clang](/implementation.md#clang): ??
36+
- [GCC](/implementation.md#gcc): ??
37+
- [ICC](/implementation.md#icc): ??
38+
- [Visual C++](/implementation.md#visual_cpp): ??
39+
40+
41+
## 参照
42+
- [P3149R11 `async_scope` - Creating scopes for non-sequential concurrency](https://open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3149r11.html)

0 commit comments

Comments
 (0)