ParallelBudget
Thread count utility for balancing thread usage involving nested loops that are all participating in the threadpool. Components which run multithreaded code within their iterated Process() methods should try and use the threading tools in this class lest they explode the thread usage.
Methods
For
#public static void For(int fromInclusive, int toExclusive, CancellationToken token, Action<int> body)
Run a loop using the threads available to the current thread.
Parameters:
| fromInclusive (int) | |
| toExclusive (int) | |
| token (CancellationToken) | |
| body (Action<int>) |
For
#Run a loop on at most maxDegree threads, sharing the budget among the loop bodies and anything nested inside them.