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.
This commit is contained in:
Patric Stout
2021-06-17 18:58:59 +02:00
committed by GitHub
parent 281a65b3e1
commit c12a152ec9
2 changed files with 3 additions and 2 deletions

View File

@@ -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 */