Rename AtomicInt and AtomicUint
Change any use of AtomicInt to AtomicIsize and AtomicUint to AtomicUsize Closes #20893 [breaking-change]
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
|
||||
use prelude::v1::*;
|
||||
|
||||
use sync::atomic::{AtomicUint, Ordering, ATOMIC_UINT_INIT};
|
||||
use sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT};
|
||||
use sync::poison::{self, LockResult};
|
||||
use sys_common::condvar as sys;
|
||||
use sys_common::mutex as sys_mutex;
|
||||
@@ -78,7 +78,7 @@ unsafe impl Sync for Condvar {}
|
||||
#[unstable = "may be merged with Condvar in the future"]
|
||||
pub struct StaticCondvar {
|
||||
inner: sys::Condvar,
|
||||
mutex: AtomicUint,
|
||||
mutex: AtomicUsize,
|
||||
}
|
||||
|
||||
unsafe impl Send for StaticCondvar {}
|
||||
@@ -88,7 +88,7 @@ unsafe impl Sync for StaticCondvar {}
|
||||
#[unstable = "may be merged with Condvar in the future"]
|
||||
pub const CONDVAR_INIT: StaticCondvar = StaticCondvar {
|
||||
inner: sys::CONDVAR_INIT,
|
||||
mutex: ATOMIC_UINT_INIT,
|
||||
mutex: ATOMIC_USIZE_INIT,
|
||||
};
|
||||
|
||||
impl Condvar {
|
||||
@@ -99,7 +99,7 @@ impl Condvar {
|
||||
Condvar {
|
||||
inner: box StaticCondvar {
|
||||
inner: unsafe { sys::Condvar::new() },
|
||||
mutex: AtomicUint::new(0),
|
||||
mutex: AtomicUsize::new(0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ use core::prelude::*;
|
||||
use sync::mpsc::Receiver;
|
||||
use sync::mpsc::blocking::{self, SignalToken};
|
||||
use core::mem;
|
||||
use sync::atomic::{AtomicUint, Ordering};
|
||||
use sync::atomic::{AtomicUsize, Ordering};
|
||||
|
||||
// Various states you can find a port in.
|
||||
const EMPTY: uint = 0; // initial state: no data, no blocked reciever
|
||||
@@ -56,7 +56,7 @@ const DISCONNECTED: uint = 2; // channel is disconnected OR upgraded
|
||||
|
||||
pub struct Packet<T> {
|
||||
// Internal state of the chan/port pair (stores the blocked task as well)
|
||||
state: AtomicUint,
|
||||
state: AtomicUsize,
|
||||
// One-shot data slot location
|
||||
data: Option<T>,
|
||||
// when used for the second time, a oneshot channel must be upgraded, and
|
||||
@@ -93,7 +93,7 @@ impl<T: Send> Packet<T> {
|
||||
Packet {
|
||||
data: None,
|
||||
upgrade: NothingSent,
|
||||
state: AtomicUint::new(EMPTY),
|
||||
state: AtomicUsize::new(EMPTY),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ use core::prelude::*;
|
||||
use core::cmp;
|
||||
use core::int;
|
||||
|
||||
use sync::atomic::{AtomicUint, AtomicInt, AtomicBool, Ordering};
|
||||
use sync::atomic::{AtomicUsize, AtomicIsize, AtomicBool, Ordering};
|
||||
use sync::mpsc::blocking::{self, SignalToken};
|
||||
use sync::mpsc::mpsc_queue as mpsc;
|
||||
use sync::mpsc::select::StartResult::*;
|
||||
@@ -42,17 +42,17 @@ const MAX_STEALS: int = 1 << 20;
|
||||
|
||||
pub struct Packet<T> {
|
||||
queue: mpsc::Queue<T>,
|
||||
cnt: AtomicInt, // How many items are on this channel
|
||||
cnt: AtomicIsize, // How many items are on this channel
|
||||
steals: int, // How many times has a port received without blocking?
|
||||
to_wake: AtomicUint, // SignalToken for wake up
|
||||
to_wake: AtomicUsize, // SignalToken for wake up
|
||||
|
||||
// The number of channels which are currently using this packet.
|
||||
channels: AtomicInt,
|
||||
channels: AtomicIsize,
|
||||
|
||||
// See the discussion in Port::drop and the channel send methods for what
|
||||
// these are used for
|
||||
port_dropped: AtomicBool,
|
||||
sender_drain: AtomicInt,
|
||||
sender_drain: AtomicIsize,
|
||||
|
||||
// this lock protects various portions of this implementation during
|
||||
// select()
|
||||
@@ -70,12 +70,12 @@ impl<T: Send> Packet<T> {
|
||||
pub fn new() -> Packet<T> {
|
||||
let p = Packet {
|
||||
queue: mpsc::Queue::new(),
|
||||
cnt: AtomicInt::new(0),
|
||||
cnt: AtomicIsize::new(0),
|
||||
steals: 0,
|
||||
to_wake: AtomicUint::new(0),
|
||||
channels: AtomicInt::new(2),
|
||||
to_wake: AtomicUsize::new(0),
|
||||
channels: AtomicIsize::new(2),
|
||||
port_dropped: AtomicBool::new(false),
|
||||
sender_drain: AtomicInt::new(0),
|
||||
sender_drain: AtomicIsize::new(0),
|
||||
select_lock: Mutex::new(()),
|
||||
};
|
||||
return p;
|
||||
|
||||
@@ -41,7 +41,7 @@ use alloc::boxed::Box;
|
||||
use core::mem;
|
||||
use core::cell::UnsafeCell;
|
||||
|
||||
use sync::atomic::{AtomicPtr, AtomicUint, Ordering};
|
||||
use sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
|
||||
|
||||
// Node within the linked list queue of messages to send
|
||||
struct Node<T> {
|
||||
@@ -69,8 +69,8 @@ pub struct Queue<T> {
|
||||
// Cache maintenance fields. Additions and subtractions are stored
|
||||
// separately in order to allow them to use nonatomic addition/subtraction.
|
||||
cache_bound: uint,
|
||||
cache_additions: AtomicUint,
|
||||
cache_subtractions: AtomicUint,
|
||||
cache_additions: AtomicUsize,
|
||||
cache_subtractions: AtomicUsize,
|
||||
}
|
||||
|
||||
unsafe impl<T: Send> Send for Queue<T> { }
|
||||
@@ -117,8 +117,8 @@ impl<T: Send> Queue<T> {
|
||||
first: UnsafeCell::new(n1),
|
||||
tail_copy: UnsafeCell::new(n1),
|
||||
cache_bound: bound,
|
||||
cache_additions: AtomicUint::new(0),
|
||||
cache_subtractions: AtomicUint::new(0),
|
||||
cache_additions: AtomicUsize::new(0),
|
||||
cache_subtractions: AtomicUsize::new(0),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ use core::cmp;
|
||||
use core::int;
|
||||
use thread::Thread;
|
||||
|
||||
use sync::atomic::{AtomicInt, AtomicUint, Ordering, AtomicBool};
|
||||
use sync::atomic::{AtomicIsize, AtomicUsize, Ordering, AtomicBool};
|
||||
use sync::mpsc::Receiver;
|
||||
use sync::mpsc::blocking::{self, SignalToken};
|
||||
use sync::mpsc::spsc_queue as spsc;
|
||||
@@ -42,9 +42,9 @@ const MAX_STEALS: int = 1 << 20;
|
||||
pub struct Packet<T> {
|
||||
queue: spsc::Queue<Message<T>>, // internal queue for all message
|
||||
|
||||
cnt: AtomicInt, // How many items are on this channel
|
||||
cnt: AtomicIsize, // How many items are on this channel
|
||||
steals: int, // How many times has a port received without blocking?
|
||||
to_wake: AtomicUint, // SignalToken for the blocked thread to wake up
|
||||
to_wake: AtomicUsize, // SignalToken for the blocked thread to wake up
|
||||
|
||||
port_dropped: AtomicBool, // flag if the channel has been destroyed.
|
||||
}
|
||||
@@ -79,9 +79,9 @@ impl<T: Send> Packet<T> {
|
||||
Packet {
|
||||
queue: unsafe { spsc::Queue::new(128) },
|
||||
|
||||
cnt: AtomicInt::new(0),
|
||||
cnt: AtomicIsize::new(0),
|
||||
steals: 0,
|
||||
to_wake: AtomicUint::new(0),
|
||||
to_wake: AtomicUsize::new(0),
|
||||
|
||||
port_dropped: AtomicBool::new(false),
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ use self::Blocker::*;
|
||||
use vec::Vec;
|
||||
use core::mem;
|
||||
|
||||
use sync::atomic::{Ordering, AtomicUint};
|
||||
use sync::atomic::{Ordering, AtomicUsize};
|
||||
use sync::mpsc::blocking::{self, WaitToken, SignalToken};
|
||||
use sync::mpsc::select::StartResult::{self, Installed, Abort};
|
||||
use sync::{Mutex, MutexGuard};
|
||||
@@ -49,7 +49,7 @@ use sync::{Mutex, MutexGuard};
|
||||
pub struct Packet<T> {
|
||||
/// Only field outside of the mutex. Just done for kicks, but mainly because
|
||||
/// the other shared channel already had the code implemented
|
||||
channels: AtomicUint,
|
||||
channels: AtomicUsize,
|
||||
|
||||
lock: Mutex<State<T>>,
|
||||
}
|
||||
@@ -138,7 +138,7 @@ fn wakeup<T>(token: SignalToken, guard: MutexGuard<State<T>>) {
|
||||
impl<T: Send> Packet<T> {
|
||||
pub fn new(cap: uint) -> Packet<T> {
|
||||
Packet {
|
||||
channels: AtomicUint::new(1),
|
||||
channels: AtomicUsize::new(1),
|
||||
lock: Mutex::new(State {
|
||||
disconnected: false,
|
||||
blocker: NoneBlocked,
|
||||
|
||||
@@ -17,7 +17,7 @@ use int;
|
||||
use marker::Sync;
|
||||
use mem::drop;
|
||||
use ops::FnOnce;
|
||||
use sync::atomic::{AtomicInt, Ordering, ATOMIC_INT_INIT};
|
||||
use sync::atomic::{AtomicIsize, Ordering, ATOMIC_ISIZE_INIT};
|
||||
use sync::{StaticMutex, MUTEX_INIT};
|
||||
|
||||
/// A synchronization primitive which can be used to run a one-time global
|
||||
@@ -39,8 +39,8 @@ use sync::{StaticMutex, MUTEX_INIT};
|
||||
#[stable]
|
||||
pub struct Once {
|
||||
mutex: StaticMutex,
|
||||
cnt: AtomicInt,
|
||||
lock_cnt: AtomicInt,
|
||||
cnt: AtomicIsize,
|
||||
lock_cnt: AtomicIsize,
|
||||
}
|
||||
|
||||
unsafe impl Sync for Once {}
|
||||
@@ -49,8 +49,8 @@ unsafe impl Sync for Once {}
|
||||
#[stable]
|
||||
pub const ONCE_INIT: Once = Once {
|
||||
mutex: MUTEX_INIT,
|
||||
cnt: ATOMIC_INT_INIT,
|
||||
lock_cnt: ATOMIC_INT_INIT,
|
||||
cnt: ATOMIC_ISIZE_INIT,
|
||||
lock_cnt: ATOMIC_ISIZE_INIT,
|
||||
};
|
||||
|
||||
impl Once {
|
||||
|
||||
Reference in New Issue
Block a user