Mark exclusive arc-related functions as unsafe. Fixes #2727.
This commit is contained in:
@@ -104,8 +104,7 @@ impl methods<T: send> for exclusive<T> {
|
|||||||
arc_destruct(self.data)
|
arc_destruct(self.data)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn with<U>(f: fn(sys::condition, x: &T) -> U) -> U {
|
unsafe fn with<U>(f: fn(sys::condition, x: &T) -> U) -> U {
|
||||||
unsafe {
|
|
||||||
let ptr: ~arc_data<ex_data<T>> =
|
let ptr: ~arc_data<ex_data<T>> =
|
||||||
unsafe::reinterpret_cast(self.data);
|
unsafe::reinterpret_cast(self.data);
|
||||||
let r = {
|
let r = {
|
||||||
@@ -118,7 +117,6 @@ impl methods<T: send> for exclusive<T> {
|
|||||||
r
|
r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Convenience code for sharing arcs between tasks
|
// Convenience code for sharing arcs between tasks
|
||||||
|
|
||||||
|
|||||||
@@ -106,13 +106,13 @@ fn create_lock() -> lock_and_signal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl methods for 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);
|
rustrt::rust_lock_cond_lock(self.lock);
|
||||||
let _r = unlock(self.lock);
|
let _r = unlock(self.lock);
|
||||||
f()
|
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);
|
rustrt::rust_lock_cond_lock(self.lock);
|
||||||
let _r = unlock(self.lock);
|
let _r = unlock(self.lock);
|
||||||
f(condition_(self.lock))
|
f(condition_(self.lock))
|
||||||
|
|||||||
Reference in New Issue
Block a user