Multi-threader refactoring

The ability to set to limit the number of threads is a requirement.

The scheduler is not magic, and can not predict which tasks will have negative scalability. And these do exist in ITK. The refactoring does not yet provide persistent resources for a thread during a task, so they may be re-allocated for each chunk during a task, which is not good for improving scalability compared to fixed splitting.

I regularly limit the threads of 1 to assist be debugging and algorithm analysis. How can you analyze the scalability of any algorithm if you have no control of the resources.

There are also cases where the program is executing on a shared resource, and the number of threads must be limited.

I could go on about use cases.

TBB seem to readily support it in a couple ways:

I still can’t get ITK with TBB to link properly with applications that use ITK w/ TBB.