diff --git a/rayon-core/src/thread_pool/mod.rs b/rayon-core/src/thread_pool/mod.rs index 5edaedc37..f238b547e 100644 --- a/rayon-core/src/thread_pool/mod.rs +++ b/rayon-core/src/thread_pool/mod.rs @@ -277,11 +277,18 @@ impl ThreadPool { // We assert that `self.registry` has not terminated. unsafe { spawn::spawn_fifo_in(op, &self.registry) } } + + /// Terminates the threads, renders the threadpool unusable. + /// This is useful for testing (miri) if the thread-pool is static. + /// It should be used upon shutdown only + pub fn terminate(&mut self) { + self.registry.terminate(); + } } impl Drop for ThreadPool { fn drop(&mut self) { - self.registry.terminate(); + self.terminate(); } }