Struct xstream_util::Rotating
source · pub struct Rotating<C> { /* private fields */ }
Expand description
A pool to manage spawning a limited number of processses
This pool will return new processes up to the limit, and then start returning old processes in a round-robin order. This type of pool is more effective if the process handles each task by delimiters as well, allowing for better utilization of resources for embarassingly parallel tasks.
Implementations§
Trait Implementations§
source§impl<C: BorrowMut<Command>> Pool for Rotating<C>
impl<C: BorrowMut<Command>> Pool for Rotating<C>
source§fn get(&mut self) -> Result<&mut Child, Error>
fn get(&mut self) -> Result<&mut Child, Error>
Get a process from the pool
If fewer than max_procs
have been spawned, this will spawn a new process, otherwise it
will return one that was already spawned.
source§fn join(&mut self) -> Result<(), Error>
fn join(&mut self) -> Result<(), Error>
Wait for all processes to finish successfully
Errors will terminate early and not wait for reamining processes to finish. To continue waiting for them anyway you can continue to call join until you get a success, this will indicate that there are no more running processes under management by the pool.