Skip to content

Commit a038d27

Browse files
committed
rust_cond_lock acquire/release should be inside the atomically { .. }
1 parent bb5db3b commit a038d27

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libcore/sys.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,17 @@ class unlock {
105105

106106
impl methods for lock_and_signal {
107107
unsafe fn lock<T>(f: fn() -> T) -> T {
108-
rustrt::rust_lock_cond_lock(self.lock);
109-
let _r = unlock(self.lock);
110108
do atomically {
109+
rustrt::rust_lock_cond_lock(self.lock);
110+
let _r = unlock(self.lock);
111111
f()
112112
}
113113
}
114114

115115
unsafe fn lock_cond<T>(f: fn(condition) -> T) -> T {
116-
rustrt::rust_lock_cond_lock(self.lock);
117-
let _r = unlock(self.lock);
118116
do atomically {
117+
rustrt::rust_lock_cond_lock(self.lock);
118+
let _r = unlock(self.lock);
119119
f(condition_(self.lock))
120120
}
121121
}

0 commit comments

Comments
 (0)