MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / start

Method start

examples/benchmark/fibonacci.cpp:56–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 Scheduler sched;
55
56 void start() & noexcept
57 {
58 if (n < cutoff)
59 {
60 stdexec::set_value(static_cast<Receiver&&>(rcvr_), serial_fib(n));
61 }
62 else
63 {
64 auto mkchild = [&](long n)
65 {
66 return stdexec::starts_on(sched, fib_sender(fib_s{cutoff, n, sched}));
67 };
68
69 exec::start_detached(
70 stdexec::when_all(mkchild(n - 1), mkchild(n - 2))
71 | stdexec::then([rcvr = static_cast<Receiver&&>(rcvr_)](long a, long b) mutable
72 { stdexec::set_value(static_cast<Receiver&&>(rcvr), a + b); }));
73 }
74 }
75 };
76
77 template <stdexec::receiver_of<completion_signatures> Receiver>

Callers

nothing calls this directly

Calls 3

set_valueFunction · 0.85
serial_fibFunction · 0.85
thenFunction · 0.85

Tested by

no test coverage detected