Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/libstd/sync/rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,15 @@ pub struct RwLockWriteGuard<'a, T: 'a> {
impl<'a, T> !marker::Send for RwLockWriteGuard<'a, 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]
pub fn new(t: T) -> RwLock<T> {
RwLock { inner: box RW_LOCK_INIT, data: UnsafeCell::new(t) }
Expand Down