mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
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.
This commit is contained in:
parent
703341051d
commit
59981e4057
@ -13,7 +13,7 @@ use intrinsics::{atomic_cxchg, atomic_xadd, atomic_xchg};
|
||||
use ptr;
|
||||
use time::Duration;
|
||||
|
||||
use sys::mutex::{mutex_lock, mutex_unlock, Mutex};
|
||||
use sys::mutex::{mutex_unlock, Mutex};
|
||||
use sys::syscall::{futex, FUTEX_WAIT, FUTEX_WAKE, FUTEX_REQUEUE};
|
||||
|
||||
pub struct Condvar {
|
||||
@ -83,8 +83,6 @@ impl Condvar {
|
||||
while atomic_xchg(*lock, 2) != 0 {
|
||||
let _ = futex(*lock, FUTEX_WAIT, 2, 0, ptr::null_mut());
|
||||
}
|
||||
|
||||
mutex_lock(*lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user