Make Core::started thread safe

develop
Pauli 2018-07-07 13:13:55 +03:00 committed by lethosor
parent 0ed5c8db39
commit 0605b9601c
2 changed files with 3 additions and 2 deletions

@ -1529,6 +1529,7 @@ Core::Core() :
HotkeyMutex{}, HotkeyMutex{},
HotkeyCond{}, HotkeyCond{},
alias_mutex{}, alias_mutex{},
started{false},
misc_data_mutex{}, misc_data_mutex{},
CoreSuspendMutex{}, CoreSuspendMutex{},
CoreWakeup{}, CoreWakeup{},
@ -1538,7 +1539,7 @@ Core::Core() :
// init the console. This must be always the first step! // init the console. This must be always the first step!
plug_mgr = 0; plug_mgr = 0;
errorstate = false; errorstate = false;
started = false; vinfo = 0;
memset(&(s_mods), 0, sizeof(s_mods)); memset(&(s_mods), 0, sizeof(s_mods));
// set up hotkey capture // set up hotkey capture

@ -283,7 +283,7 @@ namespace DFHack
df::viewscreen *top_viewscreen; df::viewscreen *top_viewscreen;
bool last_pause_state; bool last_pause_state;
// Very important! // Very important!
bool started; std::atomic<bool> started;
// Additional state change scripts // Additional state change scripts
std::vector<StateChangeScript> state_change_scripts; std::vector<StateChangeScript> state_change_scripts;