rust_cond_lock acquire/release should be inside the atomically { .. }

This commit is contained in:
Ben Blum 2012-07-24 20:28:30 -04:00
parent bb5db3bc8a
commit a038d272b0

View File

@ -105,17 +105,17 @@ class unlock {
impl methods for lock_and_signal {
unsafe fn lock<T>(f: fn() -> T) -> T {
rustrt::rust_lock_cond_lock(self.lock);
let _r = unlock(self.lock);
do atomically {
rustrt::rust_lock_cond_lock(self.lock);
let _r = unlock(self.lock);
f()
}
}
unsafe fn lock_cond<T>(f: fn(condition) -> T) -> T {
rustrt::rust_lock_cond_lock(self.lock);
let _r = unlock(self.lock);
do atomically {
rustrt::rust_lock_cond_lock(self.lock);
let _r = unlock(self.lock);
f(condition_(self.lock))
}
}