mirror of https://github.com/rust-lang/rust.git
rename std::sync::RWLock to RwLock
This commit is contained in:
parent
fc2ba13939
commit
a2c2cb942e
|
@ -59,13 +59,13 @@ use sys_common::rwlock as sys;
|
||||||
/// } // write lock is dropped here
|
/// } // write lock is dropped here
|
||||||
/// ```
|
/// ```
|
||||||
#[stable]
|
#[stable]
|
||||||
pub struct RWLock<T> {
|
pub struct RwLock<T> {
|
||||||
inner: Box<StaticRWLock>,
|
inner: Box<StaticRWLock>,
|
||||||
data: UnsafeCell<T>,
|
data: UnsafeCell<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl<T:'static+Send> Send for RWLock<T> {}
|
unsafe impl<T:'static+Send> Send for RwLock<T> {}
|
||||||
unsafe impl<T> Sync for RWLock<T> {}
|
unsafe impl<T> Sync for RwLock<T> {}
|
||||||
|
|
||||||
/// Structure representing a statically allocated RWLock.
|
/// Structure representing a statically allocated RWLock.
|
||||||
///
|
///
|
||||||
|
@ -127,11 +127,11 @@ pub struct RWLockWriteGuard<'a, T: 'a> {
|
||||||
__marker: marker::NoSend,
|
__marker: marker::NoSend,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T: Send + Sync> RWLock<T> {
|
impl<T: Send + Sync> RwLock<T> {
|
||||||
/// Creates a new instance of an RWLock which is unlocked and read to go.
|
/// Creates a new instance of an RWLock which is unlocked and read to go.
|
||||||
#[stable]
|
#[stable]
|
||||||
pub fn new(t: T) -> RWLock<T> {
|
pub fn new(t: T) -> RwLock<T> {
|
||||||
RWLock { inner: box RWLOCK_INIT, data: UnsafeCell::new(t) }
|
RwLock { inner: box RWLOCK_INIT, data: UnsafeCell::new(t) }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Locks this rwlock with shared read access, blocking the current thread
|
/// Locks this rwlock with shared read access, blocking the current thread
|
||||||
|
@ -228,7 +228,7 @@ impl<T: Send + Sync> RWLock<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[unsafe_destructor]
|
#[unsafe_destructor]
|
||||||
impl<T> Drop for RWLock<T> {
|
impl<T> Drop for RwLock<T> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe { self.inner.lock.destroy() }
|
unsafe { self.inner.lock.destroy() }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue