Struct std::sync::TaskPool[src]

pub struct TaskPool<T> {
    // some fields omitted
}

A task pool used to execute functions in parallel.

Methods

impl<T> TaskPool<T>

fn new(n_tasks: uint, init_fn_factory: || -> proc(uint): Send -> T) -> TaskPool<T>

Spawns a new task pool with n_tasks tasks. The provided init_fn_factory returns a function which, given the index of the task, should return local data to be kept around in that task.

Failure

This function will fail if n_tasks is less than 1.

fn execute(&mut self, f: proc(&T): Send)

Executes the function f on a task in the pool. The function receives a reference to the local data returned by the init_fn.

Trait Implementations

impl<T> Drop for TaskPool<T>

fn drop(&mut self)