@@ -14,12 +14,12 @@ namespace std::execition {
1414`run_loop`は、実行制御ライブラリの作業を[スケジュール](schedule.md)可能な実行リソース(execution resource)である。
1515
1616内部的にスレッドセーフなFIFO (first-in first-out) 作業キューを保持する。
17- [`run`メンバ関数](run_loop/run.md.nolink )はキューから作業を取り出し、同関数を呼び出したスレッド上のループで実行する。
17+ [`run`メンバ関数](run_loop/run.md)はキューから作業を取り出し、同関数を呼び出したスレッド上のループで実行する。
1818
1919`run_loop`インスタンスの動作説明のため、下記の説明用メンバ変数を持つ。
2020
21- - `count` : FIFOキューが保持する作業の個数
22- - `state` : 開始(starting)/ 実行中(running)/完了中 (finishing)/完了済み (finished) いずれかのインスタンス状態
21+ - `count` : キュー上に保持している作業の個数
22+ - `state` : [ 開始(starting)](run_loop/op_constructor.md)/[ 実行中(running)](run_loop/run.md)/[終了中 (finishing)](run_loop/finish.md)/[終了済み (finished)](run_loop/run.md) いずれかの状態
2323
2424
2525## メンバ関数
@@ -29,54 +29,59 @@ namespace std::execition {
2929| [`(constructor)`](run_loop/op_constructor.md) | コンストラクタ | C++26 |
3030| [`(destructor)`](run_loop/op_destructor.md) | デストラクタ | C++26 |
3131| [`get_scheduler`](run_loop/get_scheduler.md) | Scheduler取得 | C++26 |
32- | [`run`](run_loop/run.md.nolink ) | ループ実行を開始 | C++26 |
33- | [`finish`](run_loop/finish.md.nolink ) | ループ実行を終了 | C++26 |
32+ | [`run`](run_loop/run.md) | キュー上の作業を逐次実行 | C++26 |
33+ | [`finish`](run_loop/finish.md) | 状態を終了中に変更 | C++26 |
3434
3535## 説明専用のメンバ型
3636
3737| 名前 | 説明 | 対応バージョン |
3838|------|------|-------|
39- | [`run-loop-scheduler`](run_loop/run-loop-scheduler.md) | 説明専用クラス | C++26 |
40- | [`run-loop-sender`](run_loop/run-loop-sender.md) | 説明専用クラス | C++26 |
41- | [`run-loop-opstate`](run_loop/run-loop-opstate.md.nolink) | 説明専用クラス | C++26 |
39+ | [`run-loop-scheduler`](run_loop/run-loop-scheduler.md) | 動作説明用の[Scheduler型](scheduler.md) | C++26 |
40+ | [`run-loop-sender`](run_loop/run-loop-sender.md) | 動作説明用の[Sender型](sender.md) | C++26 |
41+ | [`run-loop-opstate-base`](run_loop/run-loop-opstate.md) | 動作説明用の基底クラス | C++26 |
42+ | [`run-loop-opstate`](run_loop/run-loop-opstate.md) | 動作説明用のクラステンプレート | C++26 |
4243
4344
4445## 例
4546```cpp example
47+ #include <print>
4648#include <execution>
4749namespace ex = std::execution;
4850
4951struct MyReceiver {
5052 using receiver_concept = ex::receiver_t;
5153
5254 void set_value() noexcept
53- { std::println("value "); }
55+ { std::println("success "); }
5456 void set_error(std::exception_ptr) noexcept
55- { std::println("error "); }
57+ { std::println("failure "); }
5658 void set_stopped() noexcept
57- { std::println("stopped "); }
59+ { std::println("cancellation "); }
5860};
5961
6062
6163int main()
6264{
63- // run_loopのスケジュールSenderを取得
6465 ex::run_loop loop;
65- ex::scheduler auto sch = loop.get_scheduler();
66- // state:開始(starting)
66+ // count=0, state=開始(starting)
6767
68+ // run_loopのスケジュールSenderとReceiverを接続
69+ ex::scheduler auto sch = loop.get_scheduler();
6870 ex::sender auto sndr = ex::schedule(sch);
6971 ex::receiver auto rcvr = MyReceiver{};
70- ex::operation_state auto op = ex::connect(sndr, rcvr);
71- // キューに作業を1つ追加
72+ auto op = ex::connect(sndr, rcvr);
73+
74+ // run_loopキューに作業を1つ追加
7275 ex::start(op);
76+ // count=1, state=開始(starting)
7377
74- // stateを完了中 (finished)へ遷移
78+ // run_loop状態を終了中 (finished)へ変更
7579 loop.finish();
80+ // count=1, state=終了中(finished)
7681
77- // キュー上の作業を全て処理
82+ // run_loopキュー上の作業を逐次実行
7883 loop.run();
79- // state:完了済み (finished)
84+ // count=0, state=終了済み (finished)
8085}
8186```
8287* ex::run_loop[ color ff0000]
@@ -85,16 +90,15 @@ int main()
8590* ex::schedule[ link schedule.md]
8691* ex::receiver[ link receiver.md]
8792* ex::receiver_t[ link receiver.md]
88- * ex::operation_state[ link operation_state.md]
8993* ex::connect[ link connect.md]
9094* ex::start[ link start.md]
9195* get_scheduler()[ link run_loop/get_scheduler.md]
92- * finish()[ link run_loop/finish.md.nolink ]
93- * run()[ link run_loop/run.md.nolink ]
96+ * finish()[ link run_loop/finish.md]
97+ * run()[ link run_loop/run.md]
9498
9599### 出力
96100```
97- value
101+ success
98102```
99103
100104
@@ -110,7 +114,7 @@ value
110114
111115
112116## 関連項目
113- - [ ` execution::schedule ` ] ( schedule .md)
117+ - [ ` execution::scheduler ` ] ( scheduler .md)
114118
115119
116120## 参照
0 commit comments