Skip to content

Commit 59981e4

Browse files
committed
Redox: Fix Condvar.wait(); do not lock mutex twice
The atomic_xchg() loop locks the mutex, so the call to mutex_lock is incorrect, and blocks.
1 parent 7033410 commit 59981e4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/libstd/sys/redox/condvar.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use intrinsics::{atomic_cxchg, atomic_xadd, atomic_xchg};
1313
use ptr;
1414
use time::Duration;
1515

16-
use sys::mutex::{mutex_lock, mutex_unlock, Mutex};
16+
use sys::mutex::{mutex_unlock, Mutex};
1717
use sys::syscall::{futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE};
1818

1919
pub struct Condvar {
@@ -83,8 +83,6 @@ impl Condvar {
8383
while atomic_xchg(*lock, 2) != 0 {
8484
let _ = futex(*lock, FUTEX_WAIT, 2, 0, ptr::null_mut());
8585
}
86-
87-
mutex_lock(*lock);
8886
}
8987
}
9088

0 commit comments

Comments
 (0)