core::arc - add an assert

This commit is contained in:
Ben Blum 2012-08-01 18:51:53 -04:00
parent fd536d9d3e
commit 0c3158b3a5

View File

@ -112,6 +112,7 @@ impl methods<T: send> for exclusive<T> {
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);
assert ptr.count > 0;
let r = {
let rec: &ex_data<T> = &(*ptr).data;
rec.lock.lock_cond(|c| f(c, &mut rec.data))