pub struct ThreadPoolExecutor<ID: PartialEq> { /* private fields */ }Expand description
ThreadPool Executor
The ThreadPool Executor stores Nodes in a sorted vector and sends them to be executed by the threadPool.
Note: The ThreadPool Executor ca be interrupted by sending a true value over the mpsc channel whose receiving end is owned by the ThreadPool executor.
Addendum: The main thread of the ThreadPool is conducting the scheduling so the ThreadPool will only have n-1 worker threads where n is the total number of threads allocated to the threadpool executor.
Implementations§
Source§impl<ID: PartialEq> ThreadPoolExecutor<ID>
impl<ID: PartialEq> ThreadPoolExecutor<ID>
Trait Implementations§
Source§impl<ID: PartialEq + 'static> Executor<ID> for ThreadPoolExecutor<ID>
impl<ID: PartialEq + 'static> Executor<ID> for ThreadPoolExecutor<ID>
Source§fn start(&mut self)
fn start(&mut self)
For each node in the ThreadPool executor the node will be updated and start_instant will be set to the current instant
Note: this should probably not be called individually because it will
always be called at the beginning of update_for_ms or update_loop
Source§fn check_interrupt(&mut self) -> bool
fn check_interrupt(&mut self) -> bool
Check the interrupt receiver for an interrupt
Source§fn add_node(&mut self, node: Box<dyn Node<ID>>)
fn add_node(&mut self, node: Box<dyn Node<ID>>)
Add a node to the ThreadPool Executor.
Note: Nodes can only be added to the executor when it is not running.
Additionally, only 1 node can exist per id so additional nodes added with the same id will replace the previous node of a given id
Source§fn remove_node(&mut self, id: &ID) -> Option<Box<dyn Node<ID>>>
fn remove_node(&mut self, id: &ID) -> Option<Box<dyn Node<ID>>>
Remove a node from the Threadpool Executor.
Note: Nodes can only be removed from hte executor when it is not running