forked from ROMEO/nexosim
Changes after review
This commit is contained in:
parent
4111d49295
commit
beaefe1d9e
@ -344,17 +344,15 @@ impl Simulation {
|
||||
|
||||
/// Runs the executor.
|
||||
fn run(&mut self) -> Result<(), ExecutionError> {
|
||||
// Defensive programming, shouldn't happen
|
||||
if !self.is_terminated && self.is_halted.load(Ordering::Relaxed) {
|
||||
self.is_terminated = true;
|
||||
return Err(ExecutionError::Halted);
|
||||
}
|
||||
|
||||
// Defensive programming, shouldn't happen
|
||||
if self.is_terminated {
|
||||
return Err(ExecutionError::Terminated);
|
||||
}
|
||||
|
||||
if self.is_halted.load(Ordering::Relaxed) {
|
||||
self.is_terminated = true;
|
||||
return Err(ExecutionError::Halted);
|
||||
}
|
||||
|
||||
self.executor.run(self.timeout).map_err(|e| {
|
||||
self.is_terminated = true;
|
||||
|
||||
@ -409,15 +407,15 @@ impl Simulation {
|
||||
&mut self,
|
||||
upper_time_bound: Option<MonotonicTime>,
|
||||
) -> Result<Option<MonotonicTime>, ExecutionError> {
|
||||
if !self.is_terminated && self.is_halted.load(Ordering::Relaxed) {
|
||||
self.is_terminated = true;
|
||||
return Err(ExecutionError::Halted);
|
||||
}
|
||||
|
||||
if self.is_terminated {
|
||||
return Err(ExecutionError::Terminated);
|
||||
}
|
||||
|
||||
if self.is_halted.load(Ordering::Relaxed) {
|
||||
self.is_terminated = true;
|
||||
return Err(ExecutionError::Halted);
|
||||
}
|
||||
|
||||
// Function pulling the next action. If the action is periodic, it is
|
||||
// immediately re-scheduled.
|
||||
fn pull_next_action(scheduler_queue: &mut MutexGuard<SchedulerQueue>) -> Action {
|
||||
|
Loading…
x
Reference in New Issue
Block a user