File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -381,6 +381,28 @@ async::run_triggers<"name">(42);
381381// x is now 42
382382----
383383
384+ The default behaviour is to run all of the scheduled work when
385+ `async::triggers<"name">.run()` or `async::run_triggers<"name">()` is called.
386+ To run only one work item in FIFO order, call `async::run_one_trigger<"name">()`.
387+
388+ [source,cpp]
389+ ----
390+ int x{};
391+ async::trigger_scheduler<"name", int>{}.schedule()
392+ | async::then([&] (auto i) { x = i; })
393+ | async::start_detached();
394+
395+ async::trigger_scheduler<"name", int>{}.schedule()
396+ | async::then([&] (auto i) { x = i*2; })
397+ | async::start_detached();
398+
399+ // when event occurs
400+ async::run_one_trigger<"name">(42);
401+ // x is now 42
402+ async::run_triggers<"name">(12);
403+ // x is now 24
404+ ----
405+
384406NOTE: It is possible to use a `trigger_scheduler` that takes arguments as a
385407"normal" scheduler, i.e. functions like `start_on` will work; however the
386408arguments passed to `run_triggers` will be discarded when used with constructs
You can’t perform that action at this time.
0 commit comments