mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 09:23:25 +00:00
Fix a race condition in Waiter
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
28d51a4496
commit
98bb9c5256
@ -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 {
|
||||
|
Reference in New Issue
Block a user