pub struct TaskPool<T> { channels: ~[std::comm::Chan], next_index: uint, }
impl<T> TaskPool<T>
fn new(n_tasks: uint, opt_sched_mode: std::option::Option, init_fn_factory: ~fn() -> ~fn(uint) -> T) -> TaskPool<T>
Spawns a new task pool with n_tasks
tasks. If the sched_mode
is None, the tasks run on this scheduler; otherwise, they run on a
new scheduler with the given mode. 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.
fn execute(&mut self, f: ~fn(&T))
Executes the function f
on a task in the pool. The function
receives a reference to the local data returned by the init_fn
.
impl<T> std::ops::Drop for TaskPool<T>
fn drop(&mut self)
Prefix searches with a type followed by a colon (e.g.
fn:
) to restrict the search to a given type.
Accepted types are: fn
, mod
,
struct
(or str
), enum
,
trait
, typedef
(or
tdef
).