Following on from discussion in #51, this PR adds two methods to ThreadPoolBuilder: on_thread_spawn and on_thread_finish. These allow for functions to be provided that are called immediately after each pool thread is spawned and immediately before it finishes.
An example of where these may be useful is for setting core affinity for each thread in the thread pool. This use case inspired the original PR (#51); the implementation in this PR is a completely general interface that also makes this possible.
Following on from discussion in #51, this PR adds two methods to
ThreadPoolBuilder
:on_thread_spawn
andon_thread_finish
. These allow for functions to be provided that are called immediately after each pool thread is spawned and immediately before it finishes.An example of where these may be useful is for setting core affinity for each thread in the thread pool. This use case inspired the original PR (#51); the implementation in this PR is a completely general interface that also makes this possible.