diff options
| author | Ian Douglas Scott <ian@iandouglasscott.com> | 2017-07-05 12:00:46 -0700 |
|---|---|---|
| committer | Ian Douglas Scott <ian@iandouglasscott.com> | 2017-07-07 08:34:48 -0700 |
| commit | 59981e4057bb0384712f2c34c3c36f7fb9cbeb6d (patch) | |
| tree | 99d93a0ab0d0f5642b40d6b7ff26a987f3268a1d /src/libstd | |
| parent | 703341051d857bba054f97c38f80d10aab44521c (diff) | |
| download | rust-59981e4057bb0384712f2c34c3c36f7fb9cbeb6d.tar.gz rust-59981e4057bb0384712f2c34c3c36f7fb9cbeb6d.zip | |
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.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sys/redox/condvar.rs | 4 |
1 files changed, 1 insertions, 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); } } |
