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
This commit is contained in:
Alex Crichton 2015-01-02 09:19:00 -08:00
commit 009ec5d2b0
45 changed files with 167 additions and 792 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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() }

View file

@ -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,

View file

@ -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);

View file

@ -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 {}