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) -> Vec<JoinHandle<()>>
Stops tasks queue work. All task in queue will be completed by threads.
fn stop_immediately(self) -> Result<Vec<Task>, TaskQueueError>
Stops tasks queue work immediately and return are not completed tasks
fn get_threads_count(&self) -> usize
Returns current 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
fn tasks_count(&self) -> usize
Gets tasks count in queue
Trait Implementations
impl Drop for TaskQueue[src]
fn drop(&mut self)
All task in queue will be completed by threads.