From dd64bd83b72a669a20d1b7d938f1ff76aceb0cef Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Sat, 22 Mar 2014 00:45:41 -0700 Subject: std: Move NativeMutex from &mut self to &self The proper usage of shared types is now sharing through `&self` rather than `&mut self` because the mutable version will provide stronger guarantees (no aliasing on *any* thread). --- src/libnative/io/timer_helper.rs | 2 +- src/libnative/task.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/libnative') 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/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(); } -- cgit 1.4.1-3-g733a5