mirror of
https://github.com/bertptrs/tracing-mutex.git
synced 2025-12-25 20:50:32 +01:00
Do not allow recursive locks.
This commit is contained in:
@@ -98,8 +98,8 @@ where
|
|||||||
/// would introduce a cycle, the edge is rejected and `false` is returned.
|
/// would introduce a cycle, the edge is rejected and `false` is returned.
|
||||||
pub(crate) fn add_edge(&mut self, x: V, y: V) -> bool {
|
pub(crate) fn add_edge(&mut self, x: V, y: V) -> bool {
|
||||||
if x == y {
|
if x == y {
|
||||||
// self-edges are not considered cycles
|
// self-edges are always considered cycles
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let (_, out_edges, ub) = self.add_node(x);
|
let (_, out_edges, ub) = self.add_node(x);
|
||||||
@@ -258,7 +258,9 @@ mod tests {
|
|||||||
|
|
||||||
for i in 0..NUM_NODES {
|
for i in 0..NUM_NODES {
|
||||||
for j in i..NUM_NODES {
|
for j in i..NUM_NODES {
|
||||||
edges.push((i, j));
|
if i != j {
|
||||||
|
edges.push((i, j));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -357,7 +357,9 @@ mod tests {
|
|||||||
let mut edges = Vec::with_capacity(NUM_NODES * NUM_NODES);
|
let mut edges = Vec::with_capacity(NUM_NODES * NUM_NODES);
|
||||||
for i in 0..NUM_NODES {
|
for i in 0..NUM_NODES {
|
||||||
for j in i..NUM_NODES {
|
for j in i..NUM_NODES {
|
||||||
edges.push((i, j));
|
if i != j {
|
||||||
|
edges.push((i, j));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user