SpriteOvO / spdlog-rs

Fast, highly configurable Rust logging crate
https://crates.io/crates/spdlog-rs
Apache License 2.0
107 stars 11 forks source link

Add methods to provide on spawn and on finish tasks to thread pool builder #54

Closed fpervaiz closed 9 months ago

fpervaiz commented 9 months ago

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.

SpriteOvO commented 9 months ago

Appreciate your work! ^^ PR merged and it will be included in v0.4.0 🎉