Skip to content

Commit

Permalink
Scheduler: Terminate threads when stopping
Browse files Browse the repository at this point in the history
When stopping the scheduler, particularly when destroying it, make
sure that the worker threads terminate. Otherwise deleting a running
scheduler will crash if the helper threads still access the deleted
blocks.
  • Loading branch information
frankosterfeld committed Sep 30, 2024
1 parent 65b3ae9 commit 8001544
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/include/gnuradio-4.0/Scheduler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ class SchedulerBase : public Block<Derived> {
this->emitErrorMessageIfAny("forEachBlock -> stop() -> LifecycleState", block.changeState(lifecycle::State::STOPPED));
}
});
waitDone();
this->emitErrorMessageIfAny("stop() -> LifecycleState ->STOPPED", this->changeStateTo(lifecycle::State::STOPPED));
this->emitErrorMessageIfAny("stop() -> LifecycleState ->IDLE", this->changeStateTo(lifecycle::State::IDLE));
}
Expand Down

0 comments on commit 8001544

Please sign in to comment.