Struct task_queue::TaskQueue
[−]
[src]
pub struct TaskQueue {
// some fields omitted
}Methods
impl TaskQueue[src]
fn new() -> TaskQueue
Create new task queue with 10 threads
fn with_threads(min: usize, max: usize) -> TaskQueue
Create new task quque with selected threads count
fn enqueue<F>(&mut self, f: F) -> Result<(), TaskQueueError> where F: Fn() + Send + 'static
Schedule task in queue
fn stop(self) -> Result<Vec<Task>, TaskQueueError>
Stops tasks queue work and return are not completed tasks
fn get_threads_count(&self) -> usize
returns threads count
fn get_max_threads(&self) -> usize
return max threads count
fn get_min_threads(&self) -> usize
return min threads count
fn set_spawn_policy(&mut self, policy: Box<SpawnPolicy>)
sets a policy for controlling the amount of threads