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

Function main

examples/problem.cpp:125–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125int main()
126{
127 exec::static_thread_pool pool(3);
128 auto sched = pool.get_scheduler();
129
130 // check_if_starts_inline_and_completes_on_pool(ex::schedule(sched), receiver_t{});
131 // check_if_starts_inline_and_completes_on_pool(ex::continues_on(ex::just(), sched), receiver_t{});
132 // check_if_starts_inline_and_completes_on_pool(ex::let_value(ex::continues_on(ex::just(), sched), []() { return ex::just(); }), receiver_t{});
133
134 // fails
135 // check_if_starts_inline_and_completes_on_pool(ex::starts_on(sched, ex::just()), receiver_t{});
136
137#if 0
138 print(
139 ex::get_completion_domain<ex::set_value_t>(
140 ex::get_env(
141 ex::starts_on(sched, ex::just())
142 ),
143 ex::get_env(receiver_t{})
144 )
145 );
146
147 std::cout << "main: " << std::this_thread::get_id() << "\n";
148 auto snd = ex::starts_on(sched, ex::just())
149 | ex::bulk(ex::par_unseq, 2, [](int i) {
150 std::cout << " " << i << ": " << std::this_thread::get_id() << "\n";
151 });
152 ex::sync_wait(snd);
153#else
154
155 [[maybe_unused]]
156 bool called{false};
157 // launch some work on the thread pool
158 ex::sender auto snd =
159 ex::starts_on(sched, ex::just())
160 // ex::just() | ex::continues_on(sched) | ex::let_value([]() { return ex::just(); })
161 | ex::continues_on(ex::inline_scheduler{});
162 ex::sync_wait(std::move(snd));
163#endif
164
165 return 0;
166}

Callers

nothing calls this directly

Calls 4

printFunction · 0.85
get_idFunction · 0.85
get_envFunction · 0.50
get_schedulerMethod · 0.45

Tested by

no test coverage detected