Skip to content

Commit 28b870f

Browse files
committed
engine: Prevent engine loop from being optimized out.
1 parent 6b669b9 commit 28b870f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

libopenage/engine/engine.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ Engine::Engine(mode mode,
4343
this->time_loop);
4444
}
4545

46-
this->threads.emplace_back([&]() {
47-
this->time_loop->run();
48-
49-
this->time_loop.reset();
50-
});
5146
this->threads.emplace_back([&]() {
5247
this->simulation->run();
5348

@@ -57,6 +52,11 @@ Engine::Engine(mode mode,
5752
this->running = false;
5853
}
5954
});
55+
this->threads.emplace_back([&]() {
56+
this->time_loop->run();
57+
58+
this->time_loop.reset();
59+
});
6060

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

0 commit comments

Comments
 (0)