From 152f2eade87b7930a83f9cc8da8cae08769b2faf Mon Sep 17 00:00:00 2001 From: Ben Blum Date: Tue, 10 Jul 2012 18:55:49 -0400 Subject: [PATCH] arc.rs: make exclusive's data mutable --- src/libcore/arc.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcore/arc.rs b/src/libcore/arc.rs index b28830db280..2fd03cdb7a1 100644 --- a/src/libcore/arc.rs +++ b/src/libcore/arc.rs @@ -84,7 +84,7 @@ fn clone(rc: &arc) -> arc { } // An arc over mutable data that is protected by a lock. -type ex_data = {lock: sys::lock_and_signal, data: T}; +type ex_data = {lock: sys::lock_and_signal, mut data: T}; type exclusive = arc_destruct>; fn exclusive(-data: T) -> exclusive { @@ -110,12 +110,12 @@ impl methods for exclusive { arc_destruct(self.data) } - unsafe fn with(f: fn(sys::condition, x: &T) -> U) -> U { + unsafe fn with(f: fn(sys::condition, x: &mut T) -> U) -> U { let ptr: ~arc_data> = unsafe::reinterpret_cast(self.data); let r = { let rec: &ex_data = &(*ptr).data; - rec.lock.lock_cond(|c| f(c, &rec.data)) + rec.lock.lock_cond(|c| f(c, &mut rec.data)) }; unsafe::forget(ptr); r