This patch changes check for nested TaskGroups so that it allows
parallel execution for TaskGroups. Following pattern would not work
parallelly with current check:
std::function<void()> Fn = [&]() { parallel::TaskGroup tg; tg.spawn([&]() { }); }; ThreadPool Pool; Pool.async(Fn); Pool.async(Fn); Pool.wait();
One of the TaskGroup would work sequentially as current check
verifies overall number of TaskGroup. Two not nested
TaskGroups can work parallelly but current check prevents this.
Also this patch avoids parallel mode for TaskGroup
in parallel::strategy.ThreadsRequested == 1 case.
This patch is a followup of discussion from D142318
Make const.