mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-30 13:43:55 +00:00
Only add task when waking up a sleeping task
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
d692c102ae
commit
9f1680d0f3
@ -121,8 +121,12 @@ impl Waiter {
|
||||
}
|
||||
|
||||
pub fn wake_up(&self) {
|
||||
self.is_woken_up.store(true, Ordering::SeqCst);
|
||||
add_task(self.task.clone());
|
||||
if let Ok(false) =
|
||||
self.is_woken_up
|
||||
.compare_exchange(false, true, Ordering::Acquire, Ordering::Relaxed)
|
||||
{
|
||||
add_task(self.task.clone());
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_finished(&self) {
|
||||
|
Reference in New Issue
Block a user