Currently fork_group has non-atomic counters. This is optimal for performance when fork and join are from the same task, but it's not safe to fork on multiple tasks/threads simultaneously, or fork on a different task from the join task without synchronization, if those tasks might run on different threads.
A fully atomic version should support these use-cases:
- Task trees where inner tasks create forked tasks that the root can await.
- A safer version of
detach() / post() that allows creating background tasks at various times in the application, and waiting for them to complete before shutdown.
Maybe support:
Currently
fork_grouphas non-atomic counters. This is optimal for performance when fork and join are from the same task, but it's not safe to fork on multiple tasks/threads simultaneously, or fork on a different task from the join task without synchronization, if those tasks might run on different threads.A fully atomic version should support these use-cases:
detach()/post()that allows creating background tasks at various times in the application, and waiting for them to complete before shutdown.Maybe support:
result_share()/result_ref()awaitable customizations #62