Closed
Description
When I use nested tasks with async::spawn() and async::get(), the synchronization doesn't work properly. This happens pretty consistently, and I am forced to never spawn tasks from tasks, which can be very limiting.
In the example below, some of the get()s will return before the work has completed, causing bugs.
Aside from this, the library is very convenient and works well.
Thanks!
Rob
void Function1()
{
async::task<void> tasks[100];
for (int t=0; t<100; t++)
{
tasks[t] = async::spawn([=]
{
Function2();
});
}
for (int t=0; t<100; t++)
tasks[t].get();
}
void Function2()
{
async::task<void> tasks[100];
for (int t=0; t<100; t++)
{
tasks[t] = async::spawn([=]
{
DoWork();
});
}
for (int t=0; t<100; t++)
tasks[t].get();
}
Metadata
Metadata
Assignees
Labels
No labels