Skip to content

Commit

Permalink
fix code referencing RwLockReadGuard
Browse files Browse the repository at this point in the history
  • Loading branch information
ville-h committed Jan 4, 2015
1 parent 2dcbdc1 commit 956cab6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/libstd/sync/mod.rs
Expand Up @@ -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};
Expand Down
16 changes: 8 additions & 8 deletions src/libstd/sync/rwlock.rs
Expand Up @@ -153,9 +153,9 @@ impl<T: Send + Sync> RwLock<T> {
/// The failure will occur immediately after the lock has been acquired.
#[inline]
#[stable]
pub fn read(&self) -> LockResult<RWLockReadGuard<T>> {
pub fn read(&self) -> LockResult<RwLockReadGuard<T>> {
unsafe { self.inner.lock.read() }
RWLockReadGuard::new(&*self.inner, &self.data)
RwLockReadGuard::new(&*self.inner, &self.data)
}

/// Attempt to acquire this lock with shared read access.
Expand All @@ -175,9 +175,9 @@ impl<T: Send + Sync> RwLock<T> {
/// acquired.
#[inline]
#[stable]
pub fn try_read(&self) -> TryLockResult<RWLockReadGuard<T>> {
pub fn try_read(&self) -> TryLockResult<RwLockReadGuard<T>> {
if unsafe { self.inner.lock.try_read() } {
Ok(try!(RWLockReadGuard::new(&*self.inner, &self.data)))
Ok(try!(RwLockReadGuard::new(&*self.inner, &self.data)))
} else {
Err(TryLockError::WouldBlock)
}
Expand Down Expand Up @@ -245,9 +245,9 @@ impl StaticRwLock {
/// See `RwLock::read`.
#[inline]
#[unstable = "may be merged with RwLock in the future"]
pub fn read(&'static self) -> LockResult<RWLockReadGuard<'static, ()>> {
pub fn read(&'static self) -> LockResult<RwLockReadGuard<'static, ()>> {
unsafe { self.lock.read() }
RWLockReadGuard::new(self, &DUMMY.0)
RwLockReadGuard::new(self, &DUMMY.0)
}

/// Attempt to acquire this lock with shared read access.
Expand All @@ -256,9 +256,9 @@ impl StaticRwLock {
#[inline]
#[unstable = "may be merged with RwLock in the future"]
pub fn try_read(&'static self)
-> TryLockResult<RWLockReadGuard<'static, ()>> {
-> TryLockResult<RwLockReadGuard<'static, ()>> {
if unsafe { self.lock.try_read() } {
Ok(try!(RWLockReadGuard::new(self, &DUMMY.0)))
Ok(try!(RwLockReadGuard::new(self, &DUMMY.0)))
} else {
Err(TryLockError::WouldBlock)
}
Expand Down

0 comments on commit 956cab6

Please sign in to comment.