use std::collections::{VecDeque};
use std::sync::{Arc, RwLock};
use indicatif::{MultiProgress, ProgressDrawTarget};
use crate::graph::DependencyGraph;
use crate::task::Task;
#[derive(Clone)]
pub struct TaskPool {
graph: Arc<DependencyGraph>,
queue: Arc<RwLock<VecDeque<Task>>>,
progress: Arc<MultiProgress>,
}
impl TaskPool {
pub fn new() -> Self {
Self {
queue: Arc::new(RwLock::new(VecDeque::new())),
progress: Arc::new(MultiProgress::with_draw_target(
ProgressDrawTarget::stderr_with_hz(60),
)),
graph: Arc::new(DependencyGraph::new())
}
}
}