Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to terminate thread-pool upon shutdown #903

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions rayon-core/src/thread_pool/mod.rs
Expand Up @@ -277,6 +277,13 @@ 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 unsafe fn terminate(&self) {
self.registry.terminate();
}
}

impl Drop for ThreadPool {
Expand Down