Skip to content

Commit 853bf81

Browse files
committed
Hide fairrwlock module in tests.
1 parent 04f8108 commit 853bf81

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

lightning/src/util/fairrwlock.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::sync::{TryLockResult, LockResult, RwLock, RwLockReadGuard, RwLockWriteGuard};
1+
use std::sync::{LockResult, RwLock, RwLockReadGuard, RwLockWriteGuard};
22
use std::sync::atomic::{AtomicUsize, Ordering};
33

44
/// Rust libstd's RwLock does not provide any fairness guarantees (and, in fact, when used on
@@ -17,7 +17,6 @@ pub struct FairRwLock<T> {
1717
waiting_writers: AtomicUsize,
1818
}
1919

20-
#[cfg_attr(test, allow(dead_code))]
2120
impl<T> FairRwLock<T> {
2221
pub fn new(t: T) -> Self {
2322
Self { lock: RwLock::new(t), waiting_writers: AtomicUsize::new(0) }
@@ -33,11 +32,6 @@ impl<T> FairRwLock<T> {
3332
res
3433
}
3534

36-
#[allow(dead_code)]
37-
pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<T>> {
38-
self.lock.try_write()
39-
}
40-
4135
pub fn read(&self) -> LockResult<RwLockReadGuard<T>> {
4236
if self.waiting_writers.load(Ordering::Relaxed) != 0 {
4337
let _write_queue_lock = self.lock.write();

lightning/src/util/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub mod persist;
2525
pub(crate) mod atomic_counter;
2626
pub(crate) mod byte_utils;
2727
pub(crate) mod chacha20;
28+
#[cfg(not(test))]
2829
#[cfg(feature = "std")]
2930
pub(crate) mod fairrwlock;
3031
#[cfg(fuzzing)]

0 commit comments

Comments
 (0)