From 59981e4057bb0384712f2c34c3c36f7fb9cbeb6d Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Wed, 5 Jul 2017 12:00:46 -0700 Subject: [PATCH] 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. --- src/libstd/sys/redox/condvar.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/libstd/sys/redox/condvar.rs b/src/libstd/sys/redox/condvar.rs index 0ca0987b245..fe4a89c6f3e 100644 --- a/src/libstd/sys/redox/condvar.rs +++ b/src/libstd/sys/redox/condvar.rs @@ -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); } }