[−][src]Struct procspawn::Pool
A process pool.
This works similar to spawn
but lets you retain a pool of processes. Since
procspawn is intended to isolate potentially crashing code the pool will
automatically restart broken processes.
Note that it's not possible to intercept streams of processes spawned through the pool.
When the process pool is dropped all processes are killed.
This requires the pool
feature.
Methods
impl Pool
[src]
pub fn new(size: usize) -> Result<Pool, SpawnError>
[src]
Creates the default pool.
pub fn builder(size: usize) -> PoolBuilder
[src]
Creates a builder to customize pool creation.
pub fn size(&self) -> usize
[src]
Returns the size of the pool.
pub fn queued_count(&self) -> usize
[src]
Returns the number of jobs waiting to executed in the pool.
pub fn active_count(&self) -> usize
[src]
Returns the number of currently active threads.
pub fn spawn<A: Serialize + DeserializeOwned, R: Serialize + DeserializeOwned + Send + 'static>(
&self,
args: A,
func: fn(_: A) -> R
) -> JoinHandle<R>
[src]
&self,
args: A,
func: fn(_: A) -> R
) -> JoinHandle<R>
Spawns a closure into a process of the pool.
This works exactly like procspawn::spawn
but instead
of spawning a new process, it reuses a process from the pool.
pub fn join(&self)
[src]
Joins the process pool.
pub fn shutdown(&self)
[src]
Joins and shuts down.
pub fn kill(&self)
[src]
Hard kills all processes in the pool.
After calling this the pool cannot be used any more.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Pool
impl Send for Pool
impl Sync for Pool
impl Unpin for Pool
impl !UnwindSafe for Pool
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,