diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-10 18:55:49 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-11 12:07:06 -0400 |
| commit | 152f2eade87b7930a83f9cc8da8cae08769b2faf (patch) | |
| tree | c2ec0e65530ba303e9db4d759b455c9283442e75 | |
| parent | 9c0b469613d58eba7d5f15625b589218fc903e66 (diff) | |
| download | rust-152f2eade87b7930a83f9cc8da8cae08769b2faf.tar.gz rust-152f2eade87b7930a83f9cc8da8cae08769b2faf.zip | |
arc.rs: make exclusive's data mutable
| -rw-r--r-- | src/libcore/arc.rs | 6 |
1 files 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<T: const send>(rc: &arc<T>) -> arc<T> { } // An arc over mutable data that is protected by a lock. -type ex_data<T: send> = {lock: sys::lock_and_signal, data: T}; +type ex_data<T: send> = {lock: sys::lock_and_signal, mut data: T}; type exclusive<T: send> = arc_destruct<ex_data<T>>; fn exclusive<T:send >(-data: T) -> exclusive<T> { @@ -110,12 +110,12 @@ impl methods<T: send> for exclusive<T> { arc_destruct(self.data) } - unsafe fn with<U>(f: fn(sys::condition, x: &T) -> U) -> U { + unsafe fn with<U>(f: fn(sys::condition, x: &mut T) -> U) -> U { let ptr: ~arc_data<ex_data<T>> = unsafe::reinterpret_cast(self.data); let r = { let rec: &ex_data<T> = &(*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 |
