Skip to content

Commit

Permalink
int audit - std::sync
Browse files Browse the repository at this point in the history
  • Loading branch information
nrc committed Feb 23, 2015
1 parent 5d8c9f5 commit 1db684f
Show file tree
Hide file tree
Showing 13 changed files with 177 additions and 177 deletions.
10 changes: 5 additions & 5 deletions src/libstd/sync/barrier.rs
Expand Up @@ -33,13 +33,13 @@ use sync::{Mutex, Condvar};
pub struct Barrier {
lock: Mutex<BarrierState>,
cvar: Condvar,
num_threads: uint,
num_threads: usize,
}

// The inner state of a double barrier
struct BarrierState {
count: uint,
generation_id: uint,
count: usize,
generation_id: usize,
}

/// A result returned from wait.
Expand All @@ -54,7 +54,7 @@ impl Barrier {
/// A barrier will block `n`-1 threads which call `wait` and then wake up
/// all threads at once when the `n`th thread calls `wait`.
#[stable(feature = "rust1", since = "1.0.0")]
pub fn new(n: uint) -> Barrier {
pub fn new(n: usize) -> Barrier {
Barrier {
lock: Mutex::new(BarrierState {
count: 0,
Expand Down Expand Up @@ -115,7 +115,7 @@ mod tests {

#[test]
fn test_barrier() {
const N: uint = 10;
const N: usize = 10;

let barrier = Arc::new(Barrier::new(N));
let (tx, rx) = channel();
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/sync/condvar.rs
Expand Up @@ -327,7 +327,7 @@ impl StaticCondvar {
}

fn verify(&self, mutex: &sys_mutex::Mutex) {
let addr = mutex as *const _ as uint;
let addr = mutex as *const _ as usize;
match self.mutex.compare_and_swap(0, addr, Ordering::SeqCst) {
// If we got out 0, then we have successfully bound the mutex to
// this cvar.
Expand Down Expand Up @@ -388,7 +388,7 @@ mod tests {

#[test]
fn notify_all() {
const N: uint = 10;
const N: usize = 10;

let data = Arc::new((Mutex::new(0), Condvar::new()));
let (tx, rx) = channel();
Expand Down
8 changes: 4 additions & 4 deletions src/libstd/sync/mpsc/blocking.rs
Expand Up @@ -61,17 +61,17 @@ impl SignalToken {
wake
}

/// Convert to an unsafe uint value. Useful for storing in a pipe's state
/// Convert to an unsafe usize value. Useful for storing in a pipe's state
/// flag.
#[inline]
pub unsafe fn cast_to_uint(self) -> uint {
pub unsafe fn cast_to_usize(self) -> usize {
mem::transmute(self.inner)
}

/// Convert from an unsafe uint value. Useful for retrieving a pipe's state
/// Convert from an unsafe usize value. Useful for retrieving a pipe's state
/// flag.
#[inline]
pub unsafe fn cast_from_uint(signal_ptr: uint) -> SignalToken {
pub unsafe fn cast_from_usize(signal_ptr: usize) -> SignalToken {
SignalToken { inner: mem::transmute(signal_ptr) }
}

Expand Down

0 comments on commit 1db684f

Please sign in to comment.