Skip to content

Commit 6e16f9b

Browse files
committed
Rename RWLock to RwLock in std::sys.
1 parent ce1a813 commit 6e16f9b

File tree

16 files changed

+88
-88
lines changed

16 files changed

+88
-88
lines changed

library/std/src/panicking.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::process;
2020
use crate::sync::atomic::{AtomicBool, Ordering};
2121
use crate::sys::stdio::panic_output;
2222
use crate::sys_common::backtrace;
23-
use crate::sys_common::rwlock::StaticRWLock;
23+
use crate::sys_common::rwlock::StaticRwLock;
2424
use crate::sys_common::thread_info;
2525
use crate::thread;
2626

@@ -83,7 +83,7 @@ impl Hook {
8383
}
8484
}
8585

86-
static HOOK_LOCK: StaticRWLock = StaticRWLock::new();
86+
static HOOK_LOCK: StaticRwLock = StaticRwLock::new();
8787
static mut HOOK: Hook = Hook::Default;
8888

8989
/// Registers a custom panic hook, replacing any that was previously registered.

library/std/src/sync/rwlock.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ use crate::sys_common::rwlock as sys;
7676
/// [`Mutex`]: super::Mutex
7777
#[stable(feature = "rust1", since = "1.0.0")]
7878
pub struct RwLock<T: ?Sized> {
79-
inner: sys::MovableRWLock,
79+
inner: sys::MovableRwLock,
8080
poison: poison::Flag,
8181
data: UnsafeCell<T>,
8282
}
@@ -146,7 +146,7 @@ impl<T> RwLock<T> {
146146
#[stable(feature = "rust1", since = "1.0.0")]
147147
pub fn new(t: T) -> RwLock<T> {
148148
RwLock {
149-
inner: sys::MovableRWLock::new(),
149+
inner: sys::MovableRwLock::new(),
150150
poison: poison::Flag::new(),
151151
data: UnsafeCell::new(t),
152152
}

library/std/src/sys/hermit/rwlock.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
use crate::cell::UnsafeCell;
22
use crate::sys::locks::{Condvar, Mutex};
33

4-
pub struct RWLock {
4+
pub struct RwLock {
55
lock: Mutex,
66
cond: Condvar,
77
state: UnsafeCell<State>,
88
}
99

10-
pub type MovableRWLock = RWLock;
10+
pub type MovableRwLock = RwLock;
1111

1212
enum State {
1313
Unlocked,
1414
Reading(usize),
1515
Writing,
1616
}
1717

18-
unsafe impl Send for RWLock {}
19-
unsafe impl Sync for RWLock {}
18+
unsafe impl Send for RwLock {}
19+
unsafe impl Sync for RwLock {}
2020

2121
// This rwlock implementation is a relatively simple implementation which has a
2222
// condition variable for readers/writers as well as a mutex protecting the
@@ -26,9 +26,9 @@ unsafe impl Sync for RWLock {}
2626
// hopefully correct this implementation is very likely to want to be changed in
2727
// the future.
2828

29-
impl RWLock {
30-
pub const fn new() -> RWLock {
31-
RWLock { lock: Mutex::new(), cond: Condvar::new(), state: UnsafeCell::new(State::Unlocked) }
29+
impl RwLock {
30+
pub const fn new() -> RwLock {
31+
RwLock { lock: Mutex::new(), cond: Condvar::new(), state: UnsafeCell::new(State::Unlocked) }
3232
}
3333

3434
#[inline]

library/std/src/sys/sgx/rwlock.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ use super::waitqueue::{
88
};
99
use crate::mem;
1010

11-
pub struct RWLock {
11+
pub struct RwLock {
1212
readers: SpinMutex<WaitVariable<Option<NonZeroUsize>>>,
1313
writer: SpinMutex<WaitVariable<bool>>,
1414
}
1515

16-
pub type MovableRWLock = Box<RWLock>;
16+
pub type MovableRwLock = Box<RwLock>;
1717

18-
// Check at compile time that RWLock size matches C definition (see test_c_rwlock_initializer below)
18+
// Check at compile time that RwLock size matches C definition (see test_c_rwlock_initializer below)
1919
//
2020
// # Safety
2121
// Never called, as it is a compile time check.
2222
#[allow(dead_code)]
23-
unsafe fn rw_lock_size_assert(r: RWLock) {
24-
unsafe { mem::transmute::<RWLock, [u8; 144]>(r) };
23+
unsafe fn rw_lock_size_assert(r: RwLock) {
24+
unsafe { mem::transmute::<RwLock, [u8; 144]>(r) };
2525
}
2626

27-
impl RWLock {
28-
pub const fn new() -> RWLock {
29-
RWLock {
27+
impl RwLock {
28+
pub const fn new() -> RwLock {
29+
RwLock {
3030
readers: SpinMutex::new(WaitVariable::new(None)),
3131
writer: SpinMutex::new(WaitVariable::new(false)),
3232
}
@@ -180,7 +180,7 @@ const EINVAL: i32 = 22;
180180

181181
#[cfg(not(test))]
182182
#[no_mangle]
183-
pub unsafe extern "C" fn __rust_rwlock_rdlock(p: *mut RWLock) -> i32 {
183+
pub unsafe extern "C" fn __rust_rwlock_rdlock(p: *mut RwLock) -> i32 {
184184
if p.is_null() {
185185
return EINVAL;
186186
}
@@ -190,7 +190,7 @@ pub unsafe extern "C" fn __rust_rwlock_rdlock(p: *mut RWLock) -> i32 {
190190

191191
#[cfg(not(test))]
192192
#[no_mangle]
193-
pub unsafe extern "C" fn __rust_rwlock_wrlock(p: *mut RWLock) -> i32 {
193+
pub unsafe extern "C" fn __rust_rwlock_wrlock(p: *mut RwLock) -> i32 {
194194
if p.is_null() {
195195
return EINVAL;
196196
}
@@ -199,7 +199,7 @@ pub unsafe extern "C" fn __rust_rwlock_wrlock(p: *mut RWLock) -> i32 {
199199
}
200200
#[cfg(not(test))]
201201
#[no_mangle]
202-
pub unsafe extern "C" fn __rust_rwlock_unlock(p: *mut RWLock) -> i32 {
202+
pub unsafe extern "C" fn __rust_rwlock_unlock(p: *mut RwLock) -> i32 {
203203
if p.is_null() {
204204
return EINVAL;
205205
}

library/std/src/sys/sgx/rwlock/tests.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::*;
22

3-
// Verify that the byte pattern libunwind uses to initialize an RWLock is
4-
// equivalent to the value of RWLock::new(). If the value changes,
3+
// Verify that the byte pattern libunwind uses to initialize an RwLock is
4+
// equivalent to the value of RwLock::new(). If the value changes,
55
// `src/UnwindRustSgx.h` in libunwind needs to be changed too.
66
#[test]
77
fn test_c_rwlock_initializer() {
@@ -18,9 +18,9 @@ fn test_c_rwlock_initializer() {
1818
/* 0x80 */ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
1919
];
2020

21-
// For the test to work, we need the padding/unused bytes in RWLock to be
21+
// For the test to work, we need the padding/unused bytes in RwLock to be
2222
// initialized as 0. In practice, this is the case with statics.
23-
static RUST_RWLOCK_INIT: RWLock = RWLock::new();
23+
static RUST_RWLOCK_INIT: RwLock = RwLock::new();
2424

2525
unsafe {
2626
// If the assertion fails, that not necessarily an issue with the value

library/std/src/sys/solid/os.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::os::{
88
solid::ffi::{OsStrExt, OsStringExt},
99
};
1010
use crate::path::{self, PathBuf};
11-
use crate::sys_common::rwlock::StaticRWLock;
11+
use crate::sys_common::rwlock::StaticRwLock;
1212
use crate::vec;
1313

1414
use super::{abi, error, itron, memchr};
@@ -78,7 +78,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
7878
unsupported()
7979
}
8080

81-
static ENV_LOCK: StaticRWLock = StaticRWLock::new();
81+
static ENV_LOCK: StaticRwLock = StaticRwLock::new();
8282

8383
pub struct Env {
8484
iter: vec::IntoIter<(OsString, OsString)>,

library/std/src/sys/solid/rwlock.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ use super::{
77
},
88
};
99

10-
pub struct RWLock {
10+
pub struct RwLock {
1111
/// The ID of the underlying mutex object
1212
rwl: SpinIdOnceCell<()>,
1313
}
1414

15-
pub type MovableRWLock = RWLock;
15+
pub type MovableRwLock = RwLock;
1616

1717
// Safety: `num_readers` is protected by `mtx_num_readers`
18-
unsafe impl Send for RWLock {}
19-
unsafe impl Sync for RWLock {}
18+
unsafe impl Send for RwLock {}
19+
unsafe impl Sync for RwLock {}
2020

2121
fn new_rwl() -> Result<abi::ID, ItronError> {
2222
ItronError::err_if_negative(unsafe { abi::rwl_acre_rwl() })
2323
}
2424

25-
impl RWLock {
26-
pub const fn new() -> RWLock {
27-
RWLock { rwl: SpinIdOnceCell::new() }
25+
impl RwLock {
26+
pub const fn new() -> RwLock {
27+
RwLock { rwl: SpinIdOnceCell::new() }
2828
}
2929

3030
/// Get the inner mutex's ID, which is lazily created.

library/std/src/sys/unix/locks/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ cfg_if::cfg_if! {
1010
mod pthread_rwlock; // FIXME: Implement this using a futex
1111
pub use futex::{Mutex, MovableMutex, Condvar, MovableCondvar};
1212
pub use pthread_remutex::ReentrantMutex;
13-
pub use pthread_rwlock::{RWLock, MovableRWLock};
13+
pub use pthread_rwlock::{RwLock, MovableRwLock};
1414
} else {
1515
mod pthread_mutex;
1616
mod pthread_remutex;
1717
mod pthread_rwlock;
1818
mod pthread_condvar;
1919
pub use pthread_mutex::{Mutex, MovableMutex};
2020
pub use pthread_remutex::ReentrantMutex;
21-
pub use pthread_rwlock::{RWLock, MovableRWLock};
21+
pub use pthread_rwlock::{RwLock, MovableRwLock};
2222
pub use pthread_condvar::{Condvar, MovableCondvar};
2323
}
2424
}

library/std/src/sys/unix/locks/pthread_rwlock.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
use crate::cell::UnsafeCell;
22
use crate::sync::atomic::{AtomicUsize, Ordering};
33

4-
pub struct RWLock {
4+
pub struct RwLock {
55
inner: UnsafeCell<libc::pthread_rwlock_t>,
66
write_locked: UnsafeCell<bool>, // guarded by the `inner` RwLock
77
num_readers: AtomicUsize,
88
}
99

10-
pub type MovableRWLock = Box<RWLock>;
10+
pub type MovableRwLock = Box<RwLock>;
1111

12-
unsafe impl Send for RWLock {}
13-
unsafe impl Sync for RWLock {}
12+
unsafe impl Send for RwLock {}
13+
unsafe impl Sync for RwLock {}
1414

15-
impl RWLock {
16-
pub const fn new() -> RWLock {
17-
RWLock {
15+
impl RwLock {
16+
pub const fn new() -> RwLock {
17+
RwLock {
1818
inner: UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER),
1919
write_locked: UnsafeCell::new(false),
2020
num_readers: AtomicUsize::new(0),

library/std/src/sys/unix/os.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::str;
2020
use crate::sys::cvt;
2121
use crate::sys::fd;
2222
use crate::sys::memchr;
23-
use crate::sys_common::rwlock::{StaticRWLock, StaticRWLockReadGuard};
23+
use crate::sys_common::rwlock::{StaticRwLock, StaticRwLockReadGuard};
2424
use crate::vec;
2525

2626
#[cfg(all(target_env = "gnu", not(target_os = "vxworks")))]
@@ -481,9 +481,9 @@ pub unsafe fn environ() -> *mut *const *const c_char {
481481
ptr::addr_of_mut!(environ)
482482
}
483483

484-
static ENV_LOCK: StaticRWLock = StaticRWLock::new();
484+
static ENV_LOCK: StaticRwLock = StaticRwLock::new();
485485

486-
pub fn env_read_lock() -> StaticRWLockReadGuard {
486+
pub fn env_read_lock() -> StaticRwLockReadGuard {
487487
ENV_LOCK.read()
488488
}
489489

library/std/src/sys/unsupported/locks/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ mod mutex;
33
mod rwlock;
44
pub use condvar::{Condvar, MovableCondvar};
55
pub use mutex::{MovableMutex, Mutex, ReentrantMutex};
6-
pub use rwlock::{MovableRWLock, RWLock};
6+
pub use rwlock::{MovableRwLock, RwLock};

library/std/src/sys/unsupported/locks/rwlock.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
use crate::cell::Cell;
22

3-
pub struct RWLock {
3+
pub struct RwLock {
44
// This platform has no threads, so we can use a Cell here.
55
mode: Cell<isize>,
66
}
77

8-
pub type MovableRWLock = RWLock;
8+
pub type MovableRwLock = RwLock;
99

10-
unsafe impl Send for RWLock {}
11-
unsafe impl Sync for RWLock {} // no threads on this platform
10+
unsafe impl Send for RwLock {}
11+
unsafe impl Sync for RwLock {} // no threads on this platform
1212

13-
impl RWLock {
14-
pub const fn new() -> RWLock {
15-
RWLock { mode: Cell::new(0) }
13+
impl RwLock {
14+
pub const fn new() -> RwLock {
15+
RwLock { mode: Cell::new(0) }
1616
}
1717

1818
#[inline]

library/std/src/sys/wasm/atomics/rwlock.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
use crate::cell::UnsafeCell;
22
use crate::sys::locks::{Condvar, Mutex};
33

4-
pub struct RWLock {
4+
pub struct RwLock {
55
lock: Mutex,
66
cond: Condvar,
77
state: UnsafeCell<State>,
88
}
99

10-
pub type MovableRWLock = RWLock;
10+
pub type MovableRwLock = RwLock;
1111

1212
enum State {
1313
Unlocked,
1414
Reading(usize),
1515
Writing,
1616
}
1717

18-
unsafe impl Send for RWLock {}
19-
unsafe impl Sync for RWLock {}
18+
unsafe impl Send for RwLock {}
19+
unsafe impl Sync for RwLock {}
2020

2121
// This rwlock implementation is a relatively simple implementation which has a
2222
// condition variable for readers/writers as well as a mutex protecting the
@@ -26,9 +26,9 @@ unsafe impl Sync for RWLock {}
2626
// hopefully correct this implementation is very likely to want to be changed in
2727
// the future.
2828

29-
impl RWLock {
30-
pub const fn new() -> RWLock {
31-
RWLock { lock: Mutex::new(), cond: Condvar::new(), state: UnsafeCell::new(State::Unlocked) }
29+
impl RwLock {
30+
pub const fn new() -> RwLock {
31+
RwLock { lock: Mutex::new(), cond: Condvar::new(), state: UnsafeCell::new(State::Unlocked) }
3232
}
3333

3434
#[inline]

library/std/src/sys/windows/locks/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ mod mutex;
33
mod rwlock;
44
pub use condvar::{Condvar, MovableCondvar};
55
pub use mutex::{MovableMutex, Mutex, ReentrantMutex};
6-
pub use rwlock::{MovableRWLock, RWLock};
6+
pub use rwlock::{MovableRwLock, RwLock};

library/std/src/sys/windows/locks/rwlock.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
use crate::cell::UnsafeCell;
22
use crate::sys::c;
33

4-
pub struct RWLock {
4+
pub struct RwLock {
55
inner: UnsafeCell<c::SRWLOCK>,
66
}
77

8-
pub type MovableRWLock = RWLock;
8+
pub type MovableRwLock = RwLock;
99

10-
unsafe impl Send for RWLock {}
11-
unsafe impl Sync for RWLock {}
10+
unsafe impl Send for RwLock {}
11+
unsafe impl Sync for RwLock {}
1212

13-
impl RWLock {
14-
pub const fn new() -> RWLock {
15-
RWLock { inner: UnsafeCell::new(c::SRWLOCK_INIT) }
13+
impl RwLock {
14+
pub const fn new() -> RwLock {
15+
RwLock { inner: UnsafeCell::new(c::SRWLOCK_INIT) }
1616
}
1717
#[inline]
1818
pub unsafe fn read(&self) {

0 commit comments

Comments
 (0)