Skip to content

Commit b2ab5d7

Browse files
committed
fix code and comments referencing RwLock
1 parent a2c2cb9 commit b2ab5d7

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

src/libstd/sync/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub use alloc::arc::{Arc, Weak};
2121

2222
pub use self::mutex::{Mutex, MutexGuard, StaticMutex};
2323
pub use self::mutex::MUTEX_INIT;
24-
pub use self::rwlock::{RWLock, StaticRWLock, RWLOCK_INIT};
24+
pub use self::rwlock::{RwLock, StaticRWLock, RWLOCK_INIT};
2525
pub use self::rwlock::{RWLockReadGuard, RWLockWriteGuard};
2626
pub use self::condvar::{Condvar, StaticCondvar, CONDVAR_INIT};
2727
pub use self::once::{Once, ONCE_INIT};

src/libstd/sync/rwlock.rs

+31-31
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ use sys_common::rwlock as sys;
3131
///
3232
/// # Poisoning
3333
///
34-
/// RWLocks, like Mutexes, will become poisoned on panics. Note, however, that
35-
/// an RWLock may only be poisoned if a panic occurs while it is locked
34+
/// RwLocks, like Mutexes, will become poisoned on panics. Note, however, that
35+
/// an RwLock may only be poisoned if a panic occurs while it is locked
3636
/// exclusively (write mode). If a panic occurs in any reader, then the lock
3737
/// will not be poisoned.
3838
///
3939
/// # Examples
4040
///
4141
/// ```
42-
/// use std::sync::RWLock;
42+
/// use std::sync::RwLock;
4343
///
44-
/// let lock = RWLock::new(5i);
44+
/// let lock = RwLock::new(5i);
4545
///
4646
/// // many reader locks can be held at once
4747
/// {
@@ -67,11 +67,11 @@ pub struct RwLock<T> {
6767
unsafe impl<T:'static+Send> Send for RwLock<T> {}
6868
unsafe impl<T> Sync for RwLock<T> {}
6969

70-
/// Structure representing a statically allocated RWLock.
70+
/// Structure representing a statically allocated RwLock.
7171
///
7272
/// This structure is intended to be used inside of a `static` and will provide
7373
/// automatic global access as well as lazy initialization. The internal
74-
/// resources of this RWLock, however, must be manually deallocated.
74+
/// resources of this RwLock, however, must be manually deallocated.
7575
///
7676
/// # Example
7777
///
@@ -90,7 +90,7 @@ unsafe impl<T> Sync for RwLock<T> {}
9090
/// }
9191
/// unsafe { LOCK.destroy() } // free all resources
9292
/// ```
93-
#[unstable = "may be merged with RWLock in the future"]
93+
#[unstable = "may be merged with RwLock in the future"]
9494
pub struct StaticRWLock {
9595
lock: sys::RWLock,
9696
poison: poison::Flag,
@@ -100,7 +100,7 @@ unsafe impl Send for StaticRWLock {}
100100
unsafe impl Sync for StaticRWLock {}
101101

102102
/// Constant initialization for a statically-initialized rwlock.
103-
#[unstable = "may be merged with RWLock in the future"]
103+
#[unstable = "may be merged with RwLock in the future"]
104104
pub const RWLOCK_INIT: StaticRWLock = StaticRWLock {
105105
lock: sys::RWLOCK_INIT,
106106
poison: poison::FLAG_INIT,
@@ -128,7 +128,7 @@ pub struct RWLockWriteGuard<'a, T: 'a> {
128128
}
129129

130130
impl<T: Send + Sync> RwLock<T> {
131-
/// Creates a new instance of an RWLock which is unlocked and read to go.
131+
/// Creates a new instance of an RwLock which is unlocked and read to go.
132132
#[stable]
133133
pub fn new(t: T) -> RwLock<T> {
134134
RwLock { inner: box RWLOCK_INIT, data: UnsafeCell::new(t) }
@@ -148,7 +148,7 @@ impl<T: Send + Sync> RwLock<T> {
148148
///
149149
/// # Failure
150150
///
151-
/// This function will return an error if the RWLock is poisoned. An RWLock
151+
/// This function will return an error if the RwLock is poisoned. An RwLock
152152
/// is poisoned whenever a writer panics while holding an exclusive lock.
153153
/// The failure will occur immediately after the lock has been acquired.
154154
#[inline]
@@ -169,7 +169,7 @@ impl<T: Send + Sync> RwLock<T> {
169169
///
170170
/// # Failure
171171
///
172-
/// This function will return an error if the RWLock is poisoned. An RWLock
172+
/// This function will return an error if the RwLock is poisoned. An RwLock
173173
/// is poisoned whenever a writer panics while holding an exclusive lock. An
174174
/// error will only be returned if the lock would have otherwise been
175175
/// acquired.
@@ -194,7 +194,7 @@ impl<T: Send + Sync> RwLock<T> {
194194
///
195195
/// # Failure
196196
///
197-
/// This function will return an error if the RWLock is poisoned. An RWLock
197+
/// This function will return an error if the RwLock is poisoned. An RwLock
198198
/// is poisoned whenever a writer panics while holding an exclusive lock.
199199
/// An error will be returned when the lock is acquired.
200200
#[inline]
@@ -212,7 +212,7 @@ impl<T: Send + Sync> RwLock<T> {
212212
///
213213
/// # Failure
214214
///
215-
/// This function will return an error if the RWLock is poisoned. An RWLock
215+
/// This function will return an error if the RwLock is poisoned. An RwLock
216216
/// is poisoned whenever a writer panics while holding an exclusive lock. An
217217
/// error will only be returned if the lock would have otherwise been
218218
/// acquired.
@@ -242,19 +242,19 @@ impl StaticRWLock {
242242
/// Locks this rwlock with shared read access, blocking the current thread
243243
/// until it can be acquired.
244244
///
245-
/// See `RWLock::read`.
245+
/// See `RwLock::read`.
246246
#[inline]
247-
#[unstable = "may be merged with RWLock in the future"]
247+
#[unstable = "may be merged with RwLock in the future"]
248248
pub fn read(&'static self) -> LockResult<RWLockReadGuard<'static, ()>> {
249249
unsafe { self.lock.read() }
250250
RWLockReadGuard::new(self, &DUMMY.0)
251251
}
252252

253253
/// Attempt to acquire this lock with shared read access.
254254
///
255-
/// See `RWLock::try_read`.
255+
/// See `RwLock::try_read`.
256256
#[inline]
257-
#[unstable = "may be merged with RWLock in the future"]
257+
#[unstable = "may be merged with RwLock in the future"]
258258
pub fn try_read(&'static self)
259259
-> TryLockResult<RWLockReadGuard<'static, ()>> {
260260
if unsafe { self.lock.try_read() } {
@@ -267,19 +267,19 @@ impl StaticRWLock {
267267
/// Lock this rwlock with exclusive write access, blocking the current
268268
/// thread until it can be acquired.
269269
///
270-
/// See `RWLock::write`.
270+
/// See `RwLock::write`.
271271
#[inline]
272-
#[unstable = "may be merged with RWLock in the future"]
272+
#[unstable = "may be merged with RwLock in the future"]
273273
pub fn write(&'static self) -> LockResult<RWLockWriteGuard<'static, ()>> {
274274
unsafe { self.lock.write() }
275275
RWLockWriteGuard::new(self, &DUMMY.0)
276276
}
277277

278278
/// Attempt to lock this rwlock with exclusive write access.
279279
///
280-
/// See `RWLock::try_write`.
280+
/// See `RwLock::try_write`.
281281
#[inline]
282-
#[unstable = "may be merged with RWLock in the future"]
282+
#[unstable = "may be merged with RwLock in the future"]
283283
pub fn try_write(&'static self)
284284
-> TryLockResult<RWLockWriteGuard<'static, ()>> {
285285
if unsafe { self.lock.try_write() } {
@@ -295,7 +295,7 @@ impl StaticRWLock {
295295
/// active users of the lock, and this also doesn't prevent any future users
296296
/// of this lock. This method is required to be called to not leak memory on
297297
/// all platforms.
298-
#[unstable = "may be merged with RWLock in the future"]
298+
#[unstable = "may be merged with RwLock in the future"]
299299
pub unsafe fn destroy(&'static self) {
300300
self.lock.destroy()
301301
}
@@ -365,11 +365,11 @@ mod tests {
365365
use rand::{mod, Rng};
366366
use sync::mpsc::channel;
367367
use thread::Thread;
368-
use sync::{Arc, RWLock, StaticRWLock, RWLOCK_INIT};
368+
use sync::{Arc, RwLock, StaticRWLock, RWLOCK_INIT};
369369

370370
#[test]
371371
fn smoke() {
372-
let l = RWLock::new(());
372+
let l = RwLock::new(());
373373
drop(l.read().unwrap());
374374
drop(l.write().unwrap());
375375
drop((l.read().unwrap(), l.read().unwrap()));
@@ -414,7 +414,7 @@ mod tests {
414414

415415
#[test]
416416
fn test_rw_arc_poison_wr() {
417-
let arc = Arc::new(RWLock::new(1i));
417+
let arc = Arc::new(RwLock::new(1i));
418418
let arc2 = arc.clone();
419419
let _: Result<uint, _> = Thread::spawn(move|| {
420420
let _lock = arc2.write().unwrap();
@@ -425,7 +425,7 @@ mod tests {
425425

426426
#[test]
427427
fn test_rw_arc_poison_ww() {
428-
let arc = Arc::new(RWLock::new(1i));
428+
let arc = Arc::new(RwLock::new(1i));
429429
let arc2 = arc.clone();
430430
let _: Result<uint, _> = Thread::spawn(move|| {
431431
let _lock = arc2.write().unwrap();
@@ -436,7 +436,7 @@ mod tests {
436436

437437
#[test]
438438
fn test_rw_arc_no_poison_rr() {
439-
let arc = Arc::new(RWLock::new(1i));
439+
let arc = Arc::new(RwLock::new(1i));
440440
let arc2 = arc.clone();
441441
let _: Result<uint, _> = Thread::spawn(move|| {
442442
let _lock = arc2.read().unwrap();
@@ -447,7 +447,7 @@ mod tests {
447447
}
448448
#[test]
449449
fn test_rw_arc_no_poison_rw() {
450-
let arc = Arc::new(RWLock::new(1i));
450+
let arc = Arc::new(RwLock::new(1i));
451451
let arc2 = arc.clone();
452452
let _: Result<uint, _> = Thread::spawn(move|| {
453453
let _lock = arc2.read().unwrap();
@@ -459,7 +459,7 @@ mod tests {
459459

460460
#[test]
461461
fn test_rw_arc() {
462-
let arc = Arc::new(RWLock::new(0i));
462+
let arc = Arc::new(RwLock::new(0i));
463463
let arc2 = arc.clone();
464464
let (tx, rx) = channel();
465465

@@ -497,11 +497,11 @@ mod tests {
497497

498498
#[test]
499499
fn test_rw_arc_access_in_unwind() {
500-
let arc = Arc::new(RWLock::new(1i));
500+
let arc = Arc::new(RwLock::new(1i));
501501
let arc2 = arc.clone();
502502
let _ = Thread::spawn(move|| -> () {
503503
struct Unwinder {
504-
i: Arc<RWLock<int>>,
504+
i: Arc<RwLock<int>>,
505505
}
506506
impl Drop for Unwinder {
507507
fn drop(&mut self) {

0 commit comments

Comments
 (0)