MCPcopy Create free account
hub / github.com/boostorg/cobalt / work

Function work

example/thread_pool.cpp:30–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30cobalt::task<void> work(int min_a, int max_a, int b)
31{
32 auto exec = co_await cobalt::this_coro::executor;
33 for (int a = min_a; a <= max_a; a++)
34 {
35 // the following two calls offload the work to another thread.
36 int c = co_await cpu_intense_work(a, b, boost::asio::executor_arg, exec);
37 printf("The CPU intensive result of adding %d to %d, is %d\n", a, b, c);
38 }
39}
40int main(int , char * [])
41{
42 const std::size_t n = 4u;

Callers 1

mainFunction · 0.70

Calls 1

cpu_intense_workFunction · 0.70

Tested by

no test coverage detected