|
|
@ -230,7 +230,9 @@ impl RunThread { |
|
|
|
// Do switch
|
|
|
|
// Do switch
|
|
|
|
let old = mem::replace(&mut self.state.cr, cr); |
|
|
|
let old = mem::replace(&mut self.state.cr, cr); |
|
|
|
self.state.parked.push_back(old); |
|
|
|
self.state.parked.push_back(old); |
|
|
|
self.state.cr_deadline = Some(now + *self.info.scheduler_interval.read()); |
|
|
|
|
|
|
|
|
|
|
|
self.state.start_task_switching(); |
|
|
|
|
|
|
|
|
|
|
|
} else if let Some(due) = closest_due { |
|
|
|
} else if let Some(due) = closest_due { |
|
|
|
let time = due.saturating_duration_since(now); |
|
|
|
let time = due.saturating_duration_since(now); |
|
|
|
trace!("No thread to switch to, sleep {:?}", time); |
|
|
|
trace!("No thread to switch to, sleep {:?}", time); |
|
|
@ -248,7 +250,7 @@ impl RunThread { |
|
|
|
|
|
|
|
|
|
|
|
if n_alive == 0 { |
|
|
|
if n_alive == 0 { |
|
|
|
trace!("Stop task switching, no parked threads are alive"); |
|
|
|
trace!("Stop task switching, no parked threads are alive"); |
|
|
|
self.state.cr_deadline = None; |
|
|
|
self.state.stop_task_switching(); // This should improve performance in single-threaded mode
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
match self.state.cr.cr_state { |
|
|
|
match self.state.cr.cr_state { |
|
|
|