1
Fork 0

Reference fixes.

This commit is contained in:
Eric Holk 2012-06-15 22:14:02 -04:00
parent be664ddd29
commit 2a128fa205

View file

@ -102,11 +102,14 @@ impl methods<T> for exclusive<T> {
fn with<U>(f: fn(sys::condition, x: &T) -> U) -> U { fn with<U>(f: fn(sys::condition, x: &T) -> U) -> U {
unsafe { unsafe {
let ptr: ~arc_data<ex_data<T>> = unsafe::reinterpret_cast(*self); let ptr: ~arc_data<ex_data<T>> = unsafe::reinterpret_cast(*self);
let rec: &ex_data<T> = &(*ptr).data; let r = {
let rec: &ex_data<T> = &(*ptr).data;
rec.lock.lock_cond() {|c|
f(c, &rec.data)
}
};
unsafe::forget(ptr); unsafe::forget(ptr);
rec.lock.lock_cond() {|c| r
f(c, &rec.data)
}
} }
} }
} }