mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-03 20:23:59 +00:00
Mark exclusive arc-related functions as unsafe. Fixes #2727.
This commit is contained in:
parent
697f1e38d6
commit
404afcbb41
@ -104,19 +104,17 @@ impl methods<T: send> for exclusive<T> {
|
||||
arc_destruct(self.data)
|
||||
}
|
||||
|
||||
fn with<U>(f: fn(sys::condition, x: &T) -> U) -> U {
|
||||
unsafe {
|
||||
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)
|
||||
}
|
||||
};
|
||||
unsafe::forget(ptr);
|
||||
r
|
||||
}
|
||||
unsafe fn with<U>(f: fn(sys::condition, x: &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)
|
||||
}
|
||||
};
|
||||
unsafe::forget(ptr);
|
||||
r
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,13 +106,13 @@ fn create_lock() -> lock_and_signal {
|
||||
}
|
||||
|
||||
impl methods for lock_and_signal {
|
||||
fn lock<T>(f: fn() -> T) -> T {
|
||||
unsafe fn lock<T>(f: fn() -> T) -> T {
|
||||
rustrt::rust_lock_cond_lock(self.lock);
|
||||
let _r = unlock(self.lock);
|
||||
f()
|
||||
}
|
||||
|
||||
fn lock_cond<T>(f: fn(condition) -> T) -> T {
|
||||
unsafe fn lock_cond<T>(f: fn(condition) -> T) -> T {
|
||||
rustrt::rust_lock_cond_lock(self.lock);
|
||||
let _r = unlock(self.lock);
|
||||
f(condition_(self.lock))
|
||||
|
Loading…
Reference in New Issue
Block a user