From 98bb9c52566c66437f374baee3932a2fc1be28c5 Mon Sep 17 00:00:00 2001 From: Ruihan Li Date: Sat, 30 Dec 2023 21:05:41 +0800 Subject: [PATCH] Fix a race condition in `Waiter` --- framework/aster-frame/src/sync/wait.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/aster-frame/src/sync/wait.rs b/framework/aster-frame/src/sync/wait.rs index 0d042e2c7..5561e806a 100644 --- a/framework/aster-frame/src/sync/wait.rs +++ b/framework/aster-frame/src/sync/wait.rs @@ -164,12 +164,12 @@ impl Waiter { /// make self into wait status until be called wake up pub fn wait(&self) { - self.is_woken_up.store(false, Ordering::SeqCst); self.task.inner_exclusive_access().task_status = TaskStatus::Sleeping; while !self.is_woken_up.load(Ordering::SeqCst) { schedule(); } self.task.inner_exclusive_access().task_status = TaskStatus::Runnable; + self.is_woken_up.store(false, Ordering::SeqCst); } pub fn is_woken_up(&self) -> bool {