From 9e34efc5ea7713d61ab980095e43c414c9c6f558 Mon Sep 17 00:00:00 2001 From: heinezen Date: Sat, 14 Oct 2023 19:19:49 +0200 Subject: [PATCH] engine: Prevent engine loop from being optimized out. --- libopenage/engine/engine.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libopenage/engine/engine.cpp b/libopenage/engine/engine.cpp index c3a99859862..46964b5f848 100644 --- a/libopenage/engine/engine.cpp +++ b/libopenage/engine/engine.cpp @@ -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(); @@ -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([&]() { @@ -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"); } }