Struct thread_manager::ThreadManagerRaw
source · pub struct ThreadManagerRaw<F, T>{ /* private fields */ }Expand description
A thread manager for executing jobs in parallel. This struct manages a pool of worker threads and distributes jobs among them.
§Type Parameters
F: The type of the function or closure that the threads will execute.T: The type of the value returned by the function or closure.
§Fields
wpc: The number of Workers-Per-Channel.dispatch: An instance ofDispatchCycleto manage job distribution.workers: A vector ofThreadWorkerinstances representing the worker threads.channels: A vector of job channels for dispatching jobs to workers.result_channel: A channel for collecting the results of the jobs.manager_status: An instance ofManagerStatusto track the status of the manager.
Implementations§
source§impl<F, T> ThreadManagerRaw<F, T>
impl<F, T> ThreadManagerRaw<F, T>
sourcepub fn new_asymmetric(size: usize, wpc: usize) -> Self
pub fn new_asymmetric(size: usize, wpc: usize) -> Self
Creates a new instance of ThreadManagerRaw with a specified number of worker threads
and a specific workers-per-channel ratio.
§Arguments
size: The number of worker threads to create.wpc: The number of workers per channel.
§Returns
A new instance of ThreadManagerRaw with the specified configuration.
source§impl<F, T> ThreadManagerRaw<F, T>
impl<F, T> ThreadManagerRaw<F, T>
pub fn join(&self)
pub fn terminate_all(&self)
pub fn job_distribution(&self) -> Vec<usize>
pub fn has_finished(&self) -> bool
pub fn results<'a>(&'a self) -> ResultIter<'a, T> ⓘ
pub fn yield_results<'a>(&'a self) -> YieldResultIter<'a, F, T> ⓘ
pub fn active_threads(&self) -> usize
pub fn busy_threads(&self) -> usize
pub fn waiting_threads(&self) -> usize
pub fn job_queue(&self) -> usize
pub fn sent_jobs(&self) -> usize
pub fn received_jobs(&self) -> usize
pub fn concluded_jobs(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl<F, T> !RefUnwindSafe for ThreadManagerRaw<F, T>
impl<F, T> Send for ThreadManagerRaw<F, T>
impl<F, T> !Sync for ThreadManagerRaw<F, T>
impl<F, T> Unpin for ThreadManagerRaw<F, T>
impl<F, T> !UnwindSafe for ThreadManagerRaw<F, T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more