Skip to content

Commit

Permalink
Only store DeadlockData if feature is activated
Browse files Browse the repository at this point in the history
  • Loading branch information
faern committed Dec 8, 2018
1 parent 7350489 commit 01e0f8d
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions core/src/parking_lot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,7 @@ struct ThreadData {
parked_with_timeout: Cell<bool>,

// Extra data for deadlock detection
// FIXME: once supported in stable replace with #[cfg...] & remove dummy struct/impl
#[allow(dead_code)]
#[cfg(feature = "deadlock_detection")]
deadlock_data: deadlock::DeadlockData,
}

Expand All @@ -157,6 +156,7 @@ impl ThreadData {
unpark_token: Cell::new(DEFAULT_UNPARK_TOKEN),
park_token: Cell::new(DEFAULT_PARK_TOKEN),
parked_with_timeout: Cell::new(false),
#[cfg(feature = "deadlock_detection")]
deadlock_data: deadlock::DeadlockData::new(),
}
}
Expand Down Expand Up @@ -1109,16 +1109,6 @@ pub mod deadlock {
#[cfg(feature = "deadlock_detection")]
pub(super) use super::deadlock_impl::DeadlockData;

#[cfg(not(feature = "deadlock_detection"))]
pub(super) struct DeadlockData {}

#[cfg(not(feature = "deadlock_detection"))]
impl DeadlockData {
pub(super) fn new() -> Self {
DeadlockData {}
}
}

/// Acquire a resource identified by key in the deadlock detector
/// Noop if deadlock_detection feature isn't enabled.
/// Note: Call after the resource is acquired
Expand Down

0 comments on commit 01e0f8d

Please sign in to comment.