INNER CODE UNIT · Rust
new
mratsim/constantine · constantine-rust/constantine-core/src/lib.rs:50
pub fn new(num_threads: usize) -> Self {
let ctx = unsafe { ctt_threadpool_new(num_threads.try_into().unwrap()) };
Self { ctx }
}
/// Access the private context of Threadpool
/// For use, only in Constantine's crates.
/// No guarantee of continuous support.
#[inline(always)]
pub fn get_private_context(&self) -> *mut ctt_threadpool {
self.ctx
}
}
impl Drop for Threadpool {
#[inline(always)]
fn drop(&mut self) {
unsafe { ctt_threadpool_shutdown(self.ctx) }