Skip to content

Commit

Permalink
engine: Prevent engine loop from being optimized out.
Browse files Browse the repository at this point in the history
  • Loading branch information
heinezen committed Oct 14, 2023
1 parent 6b669b9 commit 28b870f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions libopenage/engine/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ Engine::Engine(mode mode,
this->time_loop);
}

this->threads.emplace_back([&]() {
this->time_loop->run();

this->time_loop.reset();
});
this->threads.emplace_back([&]() {
this->simulation->run();

Expand All @@ -57,6 +52,11 @@ Engine::Engine(mode mode,
this->running = false;
}
});
this->threads.emplace_back([&]() {
this->time_loop->run();

this->time_loop.reset();
});

if (this->run_mode == mode::FULL) {
this->threads.emplace_back([&]() {
Expand All @@ -76,6 +76,7 @@ Engine::Engine(mode mode,
void Engine::loop() {
while (this->running) {
// TODO
log::log(MSG(MIN) << "Prevent the loop from being optimized out by compiler");
}
}

Expand Down

0 comments on commit 28b870f

Please sign in to comment.