joboccara/pipes

Concurrency question

goto40 opened this issue · 3 comments

Are there any plans to include concurrency? E.g. after a fork...?

This is a very interesting question. I'd imagine fork could send data to each of its following pipes in as many threads? And then the main thread would wait for all to finish?
Tbh I'm not experienced enough with multi-threading to implement this in an optimal manner. I would welcome any suggestion.

perhaps introducing the "map/reduce" paradigm will bear some fruit.

other than that one might be lead to believe in the C++20 co_await world one could have some immediate results.

Using std::async, the implementation would be really easy.
pipes::fork could take an optional policy argument from std::launch and forward it to std::async, or just use std::launch::async.
pipes::fork would then either need to return the std::future objects, or wait for them by itself.