Fix error

Threads not killed
Handle thread kill error
This commit is contained in:
StevSpotted
2024-12-04 16:26:18 +01:00
committed by GitHub
parent d7c1c07da5
commit 0aa4e62322

View File

@@ -302,17 +302,34 @@ int pas_la_fontion_main_enfin_ce_nest_pas_la_fontion_principale_du_programme_mai
while (running) {
renderScene(player, kelps, rocks, corals);
handleQuit();
SDL_Delay(10);
}
running = false;
player_thread.join();
fish_thread.join();
/*
for (auto& thread : threads) {
thread.join();
try{
if(player_thread.joinable())
player_thread.join();
}catch(const std::system_error& e){
std::cerr << "Exception caught: " << e.what() << std::endl;
}
try{
if(quit_thread.joinable())
quit_thread.join();
}catch(const std::system_error& e){
std::cerr << "Exception caught: " << e.what() << std::endl;
}
try {
if (fish_thread.joinable())
fish_thread.join();
} catch (const std::system_error& e) {
std::cerr << "Exception caught: " << e.what() << std::endl;
}
try {
for (auto& thread : threads) {
thread.join();
}
} catch (const std::system_error& e) {
std::cerr << "Exception caught: " << e.what() << std::endl;
}
*/
return 0;
}
@@ -393,4 +410,4 @@ void cleanup() {
}
IMG_Quit();
SDL_Quit();
}
}