[][src]Struct procspawn::Pool

pub struct Pool { /* fields omitted */ }

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]

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

impl Debug for Pool[src]

impl Drop for Pool[src]

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,