Use Arc<Deterministic>
to understand which await points are parking
This commit is contained in:
parent
62521531a6
commit
9b521d6097
2 changed files with 27 additions and 13 deletions
|
@ -366,6 +366,14 @@ impl Deterministic {
|
|||
self.state.lock().now = new_now;
|
||||
}
|
||||
|
||||
pub fn start_waiting(&self) {
|
||||
self.state.lock().waiting_backtrace = Some(backtrace::Backtrace::new_unresolved());
|
||||
}
|
||||
|
||||
pub fn finish_waiting(&self) {
|
||||
self.state.lock().waiting_backtrace.take();
|
||||
}
|
||||
|
||||
pub fn forbid_parking(&self) {
|
||||
use rand::prelude::*;
|
||||
|
||||
|
@ -500,10 +508,7 @@ impl Foreground {
|
|||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub fn start_waiting(&self) {
|
||||
match self {
|
||||
Self::Deterministic { executor, .. } => {
|
||||
executor.state.lock().waiting_backtrace =
|
||||
Some(backtrace::Backtrace::new_unresolved());
|
||||
}
|
||||
Self::Deterministic { executor, .. } => executor.start_waiting(),
|
||||
_ => panic!("this method can only be called on a deterministic executor"),
|
||||
}
|
||||
}
|
||||
|
@ -511,9 +516,7 @@ impl Foreground {
|
|||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub fn finish_waiting(&self) {
|
||||
match self {
|
||||
Self::Deterministic { executor, .. } => {
|
||||
executor.state.lock().waiting_backtrace.take();
|
||||
}
|
||||
Self::Deterministic { executor, .. } => executor.finish_waiting(),
|
||||
_ => panic!("this method can only be called on a deterministic executor"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue