Merge thread coroutine output in C++

  c++, c++20, coroutine, multithreading

If I have a multiple threads, each of which has a cppcoro::generator, is there a straghtforward construct that will merge them together (in the main thread) to a single generator (preferably FIFO)? I’m not sure how to do it in a non-hacky way, especially without wasting cycles on the main thread.

(In my case, each generator will take much more time than the main thread, so having main block each thread while it processes is fine)

Source: Windows Questions C++

LEAVE A COMMENT