diff options
Diffstat (limited to 'incria/src/deps.rs')
-rw-r--r-- | incria/src/deps.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/incria/src/deps.rs b/incria/src/deps.rs index 84411c0..d72e684 100644 --- a/incria/src/deps.rs +++ b/incria/src/deps.rs @@ -13,10 +13,10 @@ use std::{ collections::{HashMap, VecDeque}, fmt::Write, future::Future, + sync::Mutex, }; use once_cell::sync::OnceCell; -use parking_lot::Mutex; /// Identifier of a node, unique across a program run. pub type NodeId = usize; @@ -42,6 +42,7 @@ impl DepTracker { fn add_dep(&self, dep: NodeId) { self.deps .lock() + .unwrap() .entry(NODE_ID.get()) .and_modify(|v| v.deps.push(dep)) .or_insert(NodeInfo { @@ -52,14 +53,14 @@ impl DepTracker { /// See [`self::next_node_id`] fn next_node_id(&self) -> usize { - let mut lock = self.next_node_id.lock(); + let mut lock = self.next_node_id.lock().unwrap(); *lock += 1; *lock - 1 } /// See [`self::mark_dirty`] fn mark_dirty(&self, node: NodeId) { - let mut lock = self.deps.lock(); + let mut lock = self.deps.lock().unwrap(); let mut frontier = VecDeque::new(); frontier.push_back(node); while let Some(node_id) = frontier.pop_front() { @@ -85,6 +86,7 @@ impl DepTracker { fn is_dirty(&self, node: NodeId) -> bool { self.deps .lock() + .unwrap() .get(&node) .map(|v| v.dirty) .unwrap_or(false) @@ -92,7 +94,7 @@ impl DepTracker { /// See [`self::clear`] fn clear(&self, node: NodeId) { - let mut lock = self.deps.lock(); + let mut lock = self.deps.lock().unwrap(); let node = match lock.get_mut(&node) { Some(x) => x, None => return, @@ -154,7 +156,7 @@ pub fn clear(dep: NodeId) { /// Dirty nodes will be coloured grey. pub fn dep_graphviz() -> String { let mut out = String::new(); - let deps = dep_tracker().deps.lock(); + let deps = dep_tracker().deps.lock().unwrap(); writeln!(&mut out, "digraph G {{").unwrap(); for (id, info) in deps.iter() { if *id == 0 { |