summaryrefslogtreecommitdiff
path: root/src/openttd.h
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-06-17 18:58:59 +0200
committerGitHub <noreply@github.com>2021-06-17 18:58:59 +0200
commitc12a152ec972309a87ab1637091990520ce9c123 (patch)
tree836d3b619339409450596a4ecf8a6ea3bb77a88d /src/openttd.h
parent281a65b3e17310d07458652a3f6cba55aff59dc0 (diff)
downloadopenttd-c12a152ec972309a87ab1637091990520ce9c123.tar.xz
Fix: thread safety issue during exiting the game (#9380)
_exit_game is read by the draw-thread to know when to exit, but most of the time written by the game-thread.
Diffstat (limited to 'src/openttd.h')
-rw-r--r--src/openttd.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/openttd.h b/src/openttd.h
index 2cd9cc1f0..6473168ee 100644
--- a/src/openttd.h
+++ b/src/openttd.h
@@ -10,6 +10,7 @@
#ifndef OPENTTD_H
#define OPENTTD_H
+#include <atomic>
#include "core/enum_type.hpp"
/** Mode which defines the state of the game. */
@@ -52,7 +53,7 @@ enum DisplayOptions {
extern GameMode _game_mode;
extern SwitchMode _switch_mode;
-extern bool _exit_game;
+extern std::atomic<bool> _exit_game;
extern bool _save_config;
/** Modes of pausing we've got */