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/libnative | |
| 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/libnative')
| -rw-r--r-- | src/libnative/io/timer_helper.rs | 2 | ||||
| -rw-r--r-- | src/libnative/lib.rs | 2 | ||||
| -rw-r--r-- | src/libnative/task.rs | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/libnative/io/timer_helper.rs b/src/libnative/io/timer_helper.rs index c5b6705ceaa..e5f70c4e4b3 100644 --- a/src/libnative/io/timer_helper.rs +++ b/src/libnative/io/timer_helper.rs @@ -75,7 +75,7 @@ pub fn send(req: Req) { fn shutdown() { // Request a shutdown, and then wait for the task to exit unsafe { - let mut guard = TIMER_HELPER_EXIT.lock(); + let guard = TIMER_HELPER_EXIT.lock(); send(Shutdown); guard.wait(); drop(guard); diff --git a/src/libnative/lib.rs b/src/libnative/lib.rs index da8f2ea139d..34e85a9819a 100644 --- a/src/libnative/lib.rs +++ b/src/libnative/lib.rs @@ -69,7 +69,7 @@ static OS_DEFAULT_STACK_ESTIMATE: uint = 1 << 20; static OS_DEFAULT_STACK_ESTIMATE: uint = 2 * (1 << 20); #[lang = "start"] -#[cfg(not(test), not(stage0))] +#[cfg(not(test))] pub fn lang_start(main: *u8, argc: int, argv: **u8) -> int { use std::cast; start(argc, argv, proc() { diff --git a/src/libnative/task.rs b/src/libnative/task.rs index 7a42d1bfee3..659e417b8ad 100644 --- a/src/libnative/task.rs +++ b/src/libnative/task.rs @@ -190,7 +190,7 @@ impl rt::Runtime for Ops { let task = BlockedTask::block(cur_task); if times == 1 { - let mut guard = (*me).lock.lock(); + let guard = (*me).lock.lock(); (*me).awoken = false; match f(task) { Ok(()) => { @@ -202,7 +202,7 @@ impl rt::Runtime for Ops { } } else { let mut iter = task.make_selectable(times); - let mut guard = (*me).lock.lock(); + let guard = (*me).lock.lock(); (*me).awoken = false; let success = iter.all(|task| { match f(task) { @@ -232,7 +232,7 @@ impl rt::Runtime for Ops { let me = &mut *self as *mut Ops; to_wake.put_runtime(self as ~rt::Runtime); cast::forget(to_wake); - let mut guard = (*me).lock.lock(); + let guard = (*me).lock.lock(); (*me).awoken = true; guard.signal(); } |
