diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-10-10 21:59:10 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-10-10 22:09:49 -0700 |
| commit | dae48a07f34dcf714b3b57029f4e03a0b95a269e (patch) | |
| tree | 4ced3fe4c6c167508f0f7d1308473dfec676846d /src/libgreen | |
| parent | 1add4dedc131d5f98d82feafe80d92ed1f3f6d49 (diff) | |
| download | rust-dae48a07f34dcf714b3b57029f4e03a0b95a269e.tar.gz rust-dae48a07f34dcf714b3b57029f4e03a0b95a269e.zip | |
Register new snapshots
Also convert a number of `static mut` to just a plain old `static` and remove some unsafe blocks.
Diffstat (limited to 'src/libgreen')
| -rw-r--r-- | src/libgreen/lib.rs | 4 | ||||
| -rw-r--r-- | src/libgreen/sched.rs | 2 | ||||
| -rw-r--r-- | src/libgreen/stack.rs | 6 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/libgreen/lib.rs b/src/libgreen/lib.rs index 8eee7ed845f..5435a6f74d3 100644 --- a/src/libgreen/lib.rs +++ b/src/libgreen/lib.rs @@ -335,7 +335,7 @@ impl SchedPool { /// This will configure the pool according to the `config` parameter, and /// initially run `main` inside the pool of schedulers. pub fn new(config: PoolConfig) -> SchedPool { - static mut POOL_ID: AtomicUint = INIT_ATOMIC_UINT; + static POOL_ID: AtomicUint = INIT_ATOMIC_UINT; let PoolConfig { threads: nscheds, @@ -349,7 +349,7 @@ impl SchedPool { threads: vec![], handles: vec![], stealers: vec![], - id: unsafe { POOL_ID.fetch_add(1, SeqCst) }, + id: POOL_ID.fetch_add(1, SeqCst), sleepers: SleeperList::new(), stack_pool: StackPool::new(), deque_pool: deque::BufferPool::new(), diff --git a/src/libgreen/sched.rs b/src/libgreen/sched.rs index feb381e4a21..f36a43c3c29 100644 --- a/src/libgreen/sched.rs +++ b/src/libgreen/sched.rs @@ -1458,7 +1458,7 @@ mod test { #[test] fn test_spawn_sched_blocking() { use std::rt::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT}; - static mut LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT; + static LOCK: StaticNativeMutex = NATIVE_MUTEX_INIT; // Testing that a task in one scheduler can block in foreign code // without affecting other schedulers diff --git a/src/libgreen/stack.rs b/src/libgreen/stack.rs index 23b41f6c6e7..6a5772ff628 100644 --- a/src/libgreen/stack.rs +++ b/src/libgreen/stack.rs @@ -158,8 +158,8 @@ impl StackPool { } fn max_cached_stacks() -> uint { - static mut AMT: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT; - match unsafe { AMT.load(atomic::SeqCst) } { + static AMT: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT; + match AMT.load(atomic::SeqCst) { 0 => {} n => return n - 1, } @@ -169,7 +169,7 @@ fn max_cached_stacks() -> uint { let amt = amt.unwrap_or(10); // 0 is our sentinel value, so ensure that we'll never see 0 after // initialization has run - unsafe { AMT.store(amt + 1, atomic::SeqCst); } + AMT.store(amt + 1, atomic::SeqCst); return amt; } |
