diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-02 09:19:00 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-02 09:19:00 -0800 |
| commit | 009ec5d2b0c4ab0e7dc7ab2f6b15754b4da14caf (patch) | |
| tree | 8b441fd58860857f2e7bf5eabbf2226b92bf13c7 /src/libstd/sys | |
| parent | 0101bbe7acb38e8113c0cafeb7d5ae0be6448e5b (diff) | |
| parent | f3a7ec7028c76b3a1c6051131328f372b068e33a (diff) | |
| download | rust-009ec5d2b0c4ab0e7dc7ab2f6b15754b4da14caf.tar.gz rust-009ec5d2b0c4ab0e7dc7ab2f6b15754b4da14caf.zip | |
rollup merge of #20315: alexcrichton/std-sync
Conflicts: src/libstd/rt/exclusive.rs src/libstd/sync/barrier.rs src/libstd/sys/unix/pipe.rs src/test/bench/shootout-binarytrees.rs src/test/bench/shootout-fannkuch-redux.rs
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/common/thread_local.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/os.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/unix/pipe.rs | 9 | ||||
| -rw-r--r-- | src/libstd/sys/unix/timer.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/windows/mod.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/windows/mutex.rs | 2 |
6 files changed, 8 insertions, 11 deletions
diff --git a/src/libstd/sys/common/thread_local.rs b/src/libstd/sys/common/thread_local.rs index 405dd4eacf3..9d7188a37bc 100644 --- a/src/libstd/sys/common/thread_local.rs +++ b/src/libstd/sys/common/thread_local.rs @@ -137,7 +137,7 @@ pub const INIT: StaticKey = StaticKey { /// /// This value allows specific configuration of the destructor for a TLS key. pub const INIT_INNER: StaticKeyInner = StaticKeyInner { - key: atomic::INIT_ATOMIC_UINT, + key: atomic::ATOMIC_UINT_INIT, }; static INIT_KEYS: Once = ONCE_INIT; diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs index 6d145e47516..6a8f55e79c8 100644 --- a/src/libstd/sys/unix/os.rs +++ b/src/libstd/sys/unix/os.rs @@ -20,7 +20,7 @@ use libc::{mod, c_int, c_char, c_void}; use os; use path::{BytesContainer}; use ptr; -use sync::atomic::{AtomicInt, INIT_ATOMIC_INT, SeqCst}; +use sync::atomic::{AtomicInt, SeqCst}; use sys::fs::FileDesc; use os::TMPBUF_SZ; diff --git a/src/libstd/sys/unix/pipe.rs b/src/libstd/sys/unix/pipe.rs index e46814ef4a2..0ab213cd0af 100644 --- a/src/libstd/sys/unix/pipe.rs +++ b/src/libstd/sys/unix/pipe.rs @@ -10,6 +10,8 @@ use prelude::v1::*; +use prelude::*; + use libc; use c_str::CString; use mem; @@ -117,9 +119,6 @@ pub struct UnixStream { write_deadline: u64, } -unsafe impl Send for UnixStream {} -unsafe impl Sync for UnixStream {} - impl UnixStream { pub fn connect(addr: &CString, timeout: Option<u64>) -> IoResult<UnixStream> { @@ -218,6 +217,7 @@ pub struct UnixListener { path: CString, } +// we currently own the CString, so these impls should be safe unsafe impl Send for UnixListener {} unsafe impl Sync for UnixListener {} @@ -265,9 +265,6 @@ struct AcceptorInner { closed: atomic::AtomicBool, } -unsafe impl Send for AcceptorInner {} -unsafe impl Sync for AcceptorInner {} - impl UnixAcceptor { pub fn fd(&self) -> fd_t { self.inner.listener.fd() } diff --git a/src/libstd/sys/unix/timer.rs b/src/libstd/sys/unix/timer.rs index afa77140d13..80f93dd2f61 100644 --- a/src/libstd/sys/unix/timer.rs +++ b/src/libstd/sys/unix/timer.rs @@ -211,7 +211,7 @@ impl Timer { // instead of () HELPER.boot(|| {}, helper); - static ID: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT; + static ID: atomic::AtomicUint = atomic::ATOMIC_UINT_INIT; let id = ID.fetch_add(1, atomic::Relaxed); Ok(Timer { id: id, diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index c354e7b3ece..d625e63952a 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -173,7 +173,7 @@ pub fn init_net() { unsafe { static START: Once = ONCE_INIT; - START.doit(|| { + START.call_once(|| { let mut data: c::WSADATA = mem::zeroed(); let ret = c::WSAStartup(0x202, // version 2.2 &mut data); diff --git a/src/libstd/sys/windows/mutex.rs b/src/libstd/sys/windows/mutex.rs index c7b4a4cec09..e0fa02b5599 100644 --- a/src/libstd/sys/windows/mutex.rs +++ b/src/libstd/sys/windows/mutex.rs @@ -20,7 +20,7 @@ const SPIN_COUNT: DWORD = 4000; pub struct Mutex { inner: atomic::AtomicUint } -pub const MUTEX_INIT: Mutex = Mutex { inner: atomic::INIT_ATOMIC_UINT }; +pub const MUTEX_INIT: Mutex = Mutex { inner: atomic::ATOMIC_UINT_INIT }; unsafe impl Sync for Mutex {} |
