projects
/
rust-lightning
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add derives where they make sense and the bindings require them
[rust-lightning]
/
lightning
/
src
/
sync
/
nostd_sync.rs
diff --git
a/lightning/src/sync/nostd_sync.rs
b/lightning/src/sync/nostd_sync.rs
index 08d54a939be66ecccb83d30c0569d25f31a523e1..0f92bd6caa3ad7c914b304db24d5fa69a8456b85 100644
(file)
--- a/
lightning/src/sync/nostd_sync.rs
+++ b/
lightning/src/sync/nostd_sync.rs
@@
-37,10
+37,6
@@
impl<T> Mutex<T> {
Ok(MutexGuard { lock: self.inner.borrow_mut() })
}
Ok(MutexGuard { lock: self.inner.borrow_mut() })
}
- pub fn try_lock<'a>(&'a self) -> LockResult<MutexGuard<'a, T>> {
- Ok(MutexGuard { lock: self.inner.borrow_mut() })
- }
-
pub fn into_inner(self) -> LockResult<T> {
Ok(self.inner.into_inner())
}
pub fn into_inner(self) -> LockResult<T> {
Ok(self.inner.into_inner())
}
@@
-49,7
+45,7
@@
impl<T> Mutex<T> {
impl<'a, T: 'a> LockTestExt<'a> for Mutex<T> {
#[inline]
fn held_by_thread(&self) -> LockHeldState {
impl<'a, T: 'a> LockTestExt<'a> for Mutex<T> {
#[inline]
fn held_by_thread(&self) -> LockHeldState {
- if self.
lock
().is_err() { return LockHeldState::HeldByThread; }
+ if self.
inner.try_borrow_mut
().is_err() { return LockHeldState::HeldByThread; }
else { return LockHeldState::NotHeldByThread; }
}
type ExclLock = MutexGuard<'a, T>;
else { return LockHeldState::NotHeldByThread; }
}
type ExclLock = MutexGuard<'a, T>;
@@
-115,7
+111,7
@@
impl<T> RwLock<T> {
impl<'a, T: 'a> LockTestExt<'a> for RwLock<T> {
#[inline]
fn held_by_thread(&self) -> LockHeldState {
impl<'a, T: 'a> LockTestExt<'a> for RwLock<T> {
#[inline]
fn held_by_thread(&self) -> LockHeldState {
- if self.
write
().is_err() { return LockHeldState::HeldByThread; }
+ if self.
inner.try_borrow_mut
().is_err() { return LockHeldState::HeldByThread; }
else { return LockHeldState::NotHeldByThread; }
}
type ExclLock = RwLockWriteGuard<'a, T>;
else { return LockHeldState::NotHeldByThread; }
}
type ExclLock = RwLockWriteGuard<'a, T>;