mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
Added an early return to put_and_try_run
This commit is contained in:
parent
53136b8fa9
commit
8e01a59a27
@ -49,7 +49,10 @@ impl Scheduler {
|
|||||||
|
|
||||||
pub(crate) fn put_and_try_run(&self, runnable: Box<dyn Runnable>) {
|
pub(crate) fn put_and_try_run(&self, runnable: Box<dyn Runnable>) {
|
||||||
self.sequence.borrow_mut().push_back(runnable);
|
self.sequence.borrow_mut().push_back(runnable);
|
||||||
if self.lock.compare_and_swap(false, true, Ordering::Relaxed) == false {
|
if self.lock.compare_and_swap(false, true, Ordering::Relaxed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let do_next = self.sequence.borrow_mut().pop_front();
|
let do_next = self.sequence.borrow_mut().pop_front();
|
||||||
if let Some(runnable) = do_next {
|
if let Some(runnable) = do_next {
|
||||||
@ -61,4 +64,3 @@ impl Scheduler {
|
|||||||
self.lock.store(false, Ordering::Relaxed);
|
self.lock.store(false, Ordering::Relaxed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user