Skip to content

Commit

Permalink
Define ThreadManager::can_finish_session()
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Mar 4, 2025
1 parent 1b35957 commit aca5764
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions unified-scheduler-pool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,13 @@ impl<S: SpawnableScheduler<TH>, TH: TaskHandler> ThreadManager<S, TH> {
}
}

fn can_finish_session(mode: SchedulingMode, state_machine: &SchedulingStateMachine) -> bool {
match mode {
BlockVerification => state_machine.has_no_active_task(),
BlockProduction => state_machine.has_no_executing_task(),
}
}

fn take_session_result_with_timings(&mut self) -> ResultWithTimings {
self.session_result_with_timings.take().unwrap()
}
Expand Down Expand Up @@ -1784,11 +1791,8 @@ impl<S: SpawnableScheduler<TH>, TH: TaskHandler> ThreadManager<S, TH> {
},
};

is_finished = session_ending
&& (scheduling_mode == BlockVerification
&& state_machine.has_no_active_task()
|| scheduling_mode == BlockProduction
&& state_machine.has_no_executing_task());
is_finished =
session_ending && Self::can_finish_session(scheduling_mode, &state_machine);
}
assert!(mem::replace(&mut is_finished, false));

Expand Down

0 comments on commit aca5764

Please sign in to comment.