Reference fixes.
This commit is contained in:
parent
be664ddd29
commit
2a128fa205
1 changed files with 7 additions and 4 deletions
|
@ -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)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue