I haven't found anything in the docs, so is there any way to query the scheduler for (an estimate) of the amount of currently scheduled tasks? Imagine some recursive algorithm (div & conq. style) that can choose to either spawn tasks or do the computation sequentially. I don't want to flood the scheduler with bazillions of tasks, especially if there aren't enough workers available so that most tasks will be done sequentially anyways. Also, the task size tends to decrease the deeper the recursion gets.
Imho, a nice way to solve this would be to spawn tasks until the scheduler is "full" (so the currently scheduled tasks >= worker threads) and then go on sequentially. That way the early large grain recursion levels are done in parallel and the small stuff doesn't flood the scheduler.
Of course, I could count all (or just the tasks submitted by the recursion) myself (atomic inc/dec at task start/end) and comepare that to the max worker threads. But that would add a highy contended counter to all my tasks.
Probably it would be sufficient to get an estimate of the current queue size of the current task's worker, so that no synchronization would be needed.