I’m not a multi-threading expert. my main process trundles along nicely then when loading the game it calls CreateThread() to do some loading stuff. Then, while the main thread is rendering my lovely loading screen, and the new thread is loading in data, some evil player hits the top right X button, or alt+F4s the game…
Instant crash!
Unless I add code which calls my thread manager and then calls TerminateThread(). This works…but then the app does not actually properly quit, so it can’t work right. Also… I now read that TerminateThread() is not the way to exit a thread anyway, and I’ve been using it all this time… arghhh!
How do you handle quitting a multithreaded app when the player arbitrarily exist it? Nobody seems to have a definitive answer…