You can use a Barrier object. It allows an unspecified number of Tasks to run, then wait for all others to reach that point.
And you can use it in a way similar to WaitGroup in Go if you do not know which tasks from which code blocks will start to work as a specific unit of work.