libfork icon indicating copy to clipboard operation
libfork copied to clipboard

Ability to wait for a single task?

Open solbjorn opened this issue 9 months ago • 0 comments

Just curious if there's ability to wait for a single task inside a fork-join block.

Let's say that at the start of the block, I fork 3 child tasks. Then, I need results from them at 3 different times in the continuation flow. For sure, there's a join at the end of the block, but waiting for all of them in one place would decrease the efficiency.

Ia it possible to do something like that?

co_await fork(A);
co_await fork(B);
co_await fork(C);

do_some_work();

co_await wait(A);
some_more_work();

co_await wait(B);
moar_work();

co_await join;
continue_single_flow();

Or I need to let's say manually define some kind of barriers to block on waiting for single tasks?

solbjorn avatar Jul 23 '25 13:07 solbjorn