Fix: on startup, NewGRF scan could case race-condition (#9382)
Creating a thread was not thread-safe. The irony.
The video-driver has a function GameLoopPause() which first checks
if the thread is the game-thread or not. For this it needs access
to this->game_thread. This variable is set in StartNewThread().
However, due to timing, it is well possible GameLoopPause() is
called from the thread well before this->game_thread is assigned.
And so we have a race-condition!
Simply solve this by preventing a thread to start till we are
done with our bookkeeping.
(cherry picked from commit b45c006ab9
)
pull/326/head
parent
441ff7e436
commit
0550ca0854
Loading…
Reference in New Issue