Skip to content

Commit 8896f6e

Browse files
authored
Merge pull request #1940 from TheBlueMatt/2023-01-nostd-try-lock
2 parents d8a20ed + efc0244 commit 8896f6e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lightning/src/sync.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,10 @@ impl<T> RwLock<T> {
109109
}
110110

111111
pub fn try_write<'a>(&'a self) -> LockResult<RwLockWriteGuard<'a, T>> {
112-
// There is no try, grasshopper - only used for tests and expected to fail
113-
Err(())
112+
match self.inner.try_borrow_mut() {
113+
Ok(lock) => Ok(RwLockWriteGuard { lock }),
114+
Err(_) => Err(())
115+
}
114116
}
115117
}
116118

0 commit comments

Comments
 (0)