fix code referencing RwLockWriteGuard
This commit is contained in:
parent
98e6d12017
commit
44b3ddef8d
@ -22,7 +22,7 @@ pub use alloc::arc::{Arc, Weak};
|
||||
pub use self::mutex::{Mutex, MutexGuard, StaticMutex};
|
||||
pub use self::mutex::MUTEX_INIT;
|
||||
pub use self::rwlock::{RwLock, StaticRwLock, RW_LOCK_INIT};
|
||||
pub use self::rwlock::{RwLockReadGuard, RWLockWriteGuard};
|
||||
pub use self::rwlock::{RwLockReadGuard, RwLockWriteGuard};
|
||||
pub use self::condvar::{Condvar, StaticCondvar, CONDVAR_INIT};
|
||||
pub use self::once::{Once, ONCE_INIT};
|
||||
pub use self::semaphore::{Semaphore, SemaphoreGuard};
|
||||
|
@ -199,9 +199,9 @@ impl<T: Send + Sync> RwLock<T> {
|
||||
/// An error will be returned when the lock is acquired.
|
||||
#[inline]
|
||||
#[stable]
|
||||
pub fn write(&self) -> LockResult<RWLockWriteGuard<T>> {
|
||||
pub fn write(&self) -> LockResult<RwLockWriteGuard<T>> {
|
||||
unsafe { self.inner.lock.write() }
|
||||
RWLockWriteGuard::new(&*self.inner, &self.data)
|
||||
RwLockWriteGuard::new(&*self.inner, &self.data)
|
||||
}
|
||||
|
||||
/// Attempt to lock this rwlock with exclusive write access.
|
||||
@ -218,9 +218,9 @@ impl<T: Send + Sync> RwLock<T> {
|
||||
/// acquired.
|
||||
#[inline]
|
||||
#[stable]
|
||||
pub fn try_write(&self) -> TryLockResult<RWLockWriteGuard<T>> {
|
||||
pub fn try_write(&self) -> TryLockResult<RwLockWriteGuard<T>> {
|
||||
if unsafe { self.inner.lock.try_read() } {
|
||||
Ok(try!(RWLockWriteGuard::new(&*self.inner, &self.data)))
|
||||
Ok(try!(RwLockWriteGuard::new(&*self.inner, &self.data)))
|
||||
} else {
|
||||
Err(TryLockError::WouldBlock)
|
||||
}
|
||||
@ -270,9 +270,9 @@ impl StaticRwLock {
|
||||
/// See `RwLock::write`.
|
||||
#[inline]
|
||||
#[unstable = "may be merged with RwLock in the future"]
|
||||
pub fn write(&'static self) -> LockResult<RWLockWriteGuard<'static, ()>> {
|
||||
pub fn write(&'static self) -> LockResult<RwLockWriteGuard<'static, ()>> {
|
||||
unsafe { self.lock.write() }
|
||||
RWLockWriteGuard::new(self, &DUMMY.0)
|
||||
RwLockWriteGuard::new(self, &DUMMY.0)
|
||||
}
|
||||
|
||||
/// Attempt to lock this rwlock with exclusive write access.
|
||||
@ -281,9 +281,9 @@ impl StaticRwLock {
|
||||
#[inline]
|
||||
#[unstable = "may be merged with RwLock in the future"]
|
||||
pub fn try_write(&'static self)
|
||||
-> TryLockResult<RWLockWriteGuard<'static, ()>> {
|
||||
-> TryLockResult<RwLockWriteGuard<'static, ()>> {
|
||||
if unsafe { self.lock.try_write() } {
|
||||
Ok(try!(RWLockWriteGuard::new(self, &DUMMY.0)))
|
||||
Ok(try!(RwLockWriteGuard::new(self, &DUMMY.0)))
|
||||
} else {
|
||||
Err(TryLockError::WouldBlock)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user