Rollup merge of #21477 - steveklabnik:gh21440, r=alexcrichton
Fixes #21440"
This commit is contained in:
commit
22ed381ada
1 changed files with 9 additions and 1 deletions
|
@ -130,7 +130,15 @@ pub struct RwLockWriteGuard<'a, T: 'a> {
|
||||||
impl<'a, T> !marker::Send for RwLockWriteGuard<'a, T> {}
|
impl<'a, T> !marker::Send for RwLockWriteGuard<'a, T> {}
|
||||||
|
|
||||||
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<T>` which is unlocked.
|
||||||
|
///
|
||||||
|
/// # Examples
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// use std::sync::RwLock;
|
||||||
|
///
|
||||||
|
/// let lock = RwLock::new(5);
|
||||||
|
/// ```
|
||||||
#[stable]
|
#[stable]
|
||||||
pub fn new(t: T) -> RwLock<T> {
|
pub fn new(t: T) -> RwLock<T> {
|
||||||
RwLock { inner: box RW_LOCK_INIT, data: UnsafeCell::new(t) }
|
RwLock { inner: box RW_LOCK_INIT, data: UnsafeCell::new(t) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue