refactor `FutexFuture::drop`: using `waiter.inner.futex` instead of `waiter.thread.proc().get_futex()`
@@ -153,18 +153,15 @@ impl Futex {
fn drop(&mut self) {
let inner = self.waiter.inner.lock();
if !inner.woken {
- if let Some(thread) = &self.waiter.thread {
- let futex = thread.proc().get_futex(inner.futex.value);
+ let futex = inner.futex.clone();
let queue = &mut futex.inner.lock().waiter_queue;
- if let Some(pos) = queue.iter().position(|x| Arc::ptr_eq(&x, &self.waiter))
- {
+ if let Some(pos) = queue.iter().position(|x| Arc::ptr_eq(&x, &self.waiter)) {
// Nobody cares about the order of queue, so just remove faster
queue.swap_remove_back(pos);
}
}
}
}
- }
FutexFuture {
waiter: Arc::new(Waiter {
thread,
