diff options
| author | bors <bors@rust-lang.org> | 2014-08-06 08:31:28 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-08-06 08:31:28 +0000 |
| commit | 84782c4e2681496d57f1ac91468d21df085b7782 (patch) | |
| tree | d3de416e5827122ec85f0a02388a48ee760ee77e /src/libnative | |
| parent | 223c043110c0eb35847bca41e58c0ce11110d78a (diff) | |
| parent | 68bde0a07396efb415d61047c6b2a8183f47ef30 (diff) | |
| download | rust-84782c4e2681496d57f1ac91468d21df085b7782.tar.gz rust-84782c4e2681496d57f1ac91468d21df085b7782.zip | |
auto merge of #16258 : aturon/rust/stabilize-atomics, r=alexcrichton
This commit stabilizes the `std::sync::atomics` module, renaming it to `std::sync::atomic` to match library precedent elsewhere, and tightening up behavior around incorrect memory ordering annotations. The vast majority of the module is now `stable`. However, the `AtomicOption` type has been deprecated, since it is essentially unused and is not truly a primitive atomic type. It will eventually be replaced by a higher-level abstraction like MVars. Due to deprecations, this is a: [breaking-change]
Diffstat (limited to 'src/libnative')
| -rw-r--r-- | src/libnative/io/pipe_win32.rs | 18 | ||||
| -rw-r--r-- | src/libnative/io/timer_unix.rs | 6 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/libnative/io/pipe_win32.rs b/src/libnative/io/pipe_win32.rs index d5b22b4b018..87129bba845 100644 --- a/src/libnative/io/pipe_win32.rs +++ b/src/libnative/io/pipe_win32.rs @@ -92,7 +92,7 @@ use std::os; use std::ptr; use std::rt::rtio; use std::rt::rtio::{IoResult, IoError}; -use std::sync::atomics; +use std::sync::atomic; use std::rt::mutex; use super::c; @@ -128,8 +128,8 @@ impl Drop for Event { struct Inner { handle: libc::HANDLE, lock: mutex::NativeMutex, - read_closed: atomics::AtomicBool, - write_closed: atomics::AtomicBool, + read_closed: atomic::AtomicBool, + write_closed: atomic::AtomicBool, } impl Inner { @@ -137,8 +137,8 @@ impl Inner { Inner { handle: handle, lock: unsafe { mutex::NativeMutex::new() }, - read_closed: atomics::AtomicBool::new(false), - write_closed: atomics::AtomicBool::new(false), + read_closed: atomic::AtomicBool::new(false), + write_closed: atomic::AtomicBool::new(false), } } } @@ -326,11 +326,11 @@ impl UnixStream { fn handle(&self) -> libc::HANDLE { self.inner.handle } fn read_closed(&self) -> bool { - self.inner.read_closed.load(atomics::SeqCst) + self.inner.read_closed.load(atomic::SeqCst) } fn write_closed(&self) -> bool { - self.inner.write_closed.load(atomics::SeqCst) + self.inner.write_closed.load(atomic::SeqCst) } fn cancel_io(&self) -> IoResult<()> { @@ -525,14 +525,14 @@ impl rtio::RtioPipe for UnixStream { // and 2 with a lock with respect to close_read(), we're guaranteed that // no thread will erroneously sit in a read forever. let _guard = unsafe { self.inner.lock.lock() }; - self.inner.read_closed.store(true, atomics::SeqCst); + self.inner.read_closed.store(true, atomic::SeqCst); self.cancel_io() } fn close_write(&mut self) -> IoResult<()> { // see comments in close_read() for why this lock is necessary let _guard = unsafe { self.inner.lock.lock() }; - self.inner.write_closed.store(true, atomics::SeqCst); + self.inner.write_closed.store(true, atomic::SeqCst); self.cancel_io() } diff --git a/src/libnative/io/timer_unix.rs b/src/libnative/io/timer_unix.rs index 87c320e0457..06d48f2f886 100644 --- a/src/libnative/io/timer_unix.rs +++ b/src/libnative/io/timer_unix.rs @@ -52,7 +52,7 @@ use std::os; use std::ptr; use std::rt::rtio; use std::rt::rtio::IoResult; -use std::sync::atomics; +use std::sync::atomic; use std::comm; use io::c; @@ -207,8 +207,8 @@ impl Timer { // instead of () unsafe { HELPER.boot(|| {}, helper); } - static mut ID: atomics::AtomicUint = atomics::INIT_ATOMIC_UINT; - let id = unsafe { ID.fetch_add(1, atomics::Relaxed) }; + static mut ID: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT; + let id = unsafe { ID.fetch_add(1, atomic::Relaxed) }; Ok(Timer { id: id, inner: Some(box Inner { |
