diff options
| author | bors <bors@rust-lang.org> | 2014-03-24 18:11:51 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-24 18:11:51 -0700 |
| commit | 6bf3fca8ff90bbeff8d5c437aa784d0dbf8f9455 (patch) | |
| tree | 7fe1f4e9c71ec942f54defdd4b1be123f212804f /src/libstd/rt | |
| parent | bcaaffbe1e1c6a6a3abdabdb4fdaef36358dae33 (diff) | |
| parent | 218461d01049242e3544337055b7f6d06943344b (diff) | |
| download | rust-6bf3fca8ff90bbeff8d5c437aa784d0dbf8f9455.tar.gz rust-6bf3fca8ff90bbeff8d5c437aa784d0dbf8f9455.zip | |
auto merge of #12900 : alexcrichton/rust/rewrite-sync, r=brson
* Remove clone-ability from all primitives. All shared state will now come
from the usage of the primitives being shared, not the primitives being
inherently shareable. This allows for fewer allocations for stack-allocated
primitives.
* Add `Mutex<T>` and `RWLock<T>` which are stack-allocated primitives for purely
wrapping a piece of data
* Remove `RWArc<T>` in favor of `Arc<RWLock<T>>`
* Remove `MutexArc<T>` in favor of `Arc<Mutex<T>>`
* Shuffle around where things are located
* The `arc` module now only contains `Arc`
* A new `lock` module contains `Mutex`, `RWLock`, and `Barrier`
* A new `raw` module contains the primitive implementations of `Semaphore`,
`Mutex`, and `RWLock`
* The Deref/DerefMut trait was implemented where appropriate
* `CowArc` was removed, the functionality is now part of `Arc` and is tagged
with `#[experimental]`.
* The crate now has #[deny(missing_doc)]
* `Arc` now supports weak pointers
This is not a large-scale rewrite of the functionality contained within the
`sync` crate, but rather a shuffling of who does what an a thinner hierarchy of
ownership to allow for better composability.
Diffstat (limited to 'src/libstd/rt')
| -rw-r--r-- | src/libstd/rt/bookkeeping.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/rt/bookkeeping.rs b/src/libstd/rt/bookkeeping.rs index 5851a6a39c6..932cd7af033 100644 --- a/src/libstd/rt/bookkeeping.rs +++ b/src/libstd/rt/bookkeeping.rs @@ -34,7 +34,7 @@ pub fn increment() { pub fn decrement() { unsafe { if TASK_COUNT.fetch_sub(1, atomics::SeqCst) == 1 { - let mut guard = TASK_LOCK.lock(); + let guard = TASK_LOCK.lock(); guard.signal(); } } @@ -44,7 +44,7 @@ pub fn decrement() { /// the entry points of native programs pub fn wait_for_other_tasks() { unsafe { - let mut guard = TASK_LOCK.lock(); + let guard = TASK_LOCK.lock(); while TASK_COUNT.load(atomics::SeqCst) > 0 { guard.wait(); } |
