mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-27 14:08:39 +01:00
Kill background thread on client shutdown.
This commit is contained in:
parent
71e265f52b
commit
4e6aa809de
1 changed files with 9 additions and 3 deletions
|
@ -18,16 +18,21 @@
|
||||||
#include "steam_client.h"
|
#include "steam_client.h"
|
||||||
#include "settings_parser.h"
|
#include "settings_parser.h"
|
||||||
|
|
||||||
|
static bool kill_background_thread;
|
||||||
static void background_thread(Steam_Client *client)
|
static void background_thread(Steam_Client *client)
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("background thread starting\n");
|
PRINT_DEBUG("background thread starting\n");
|
||||||
while (1) {
|
while (1) {
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
global_mutex.lock();
|
global_mutex.lock();
|
||||||
if (!client->network->isAlive()) {
|
bool net_alive = client->network->isAlive();
|
||||||
|
if (!net_alive || kill_background_thread) {
|
||||||
global_mutex.unlock();
|
global_mutex.unlock();
|
||||||
//delete network;
|
if (!net_alive) {
|
||||||
|
//delete network;
|
||||||
|
}
|
||||||
|
|
||||||
|
kill_background_thread = false;
|
||||||
PRINT_DEBUG("background thread exit\n");
|
PRINT_DEBUG("background thread exit\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -701,6 +706,7 @@ void Steam_Client::SetWarningMessageHook( SteamAPIWarningMessageHook_t pFunction
|
||||||
bool Steam_Client::BShutdownIfAllPipesClosed()
|
bool Steam_Client::BShutdownIfAllPipesClosed()
|
||||||
{
|
{
|
||||||
PRINT_DEBUG("BShutdownIfAllPipesClosed\n");
|
PRINT_DEBUG("BShutdownIfAllPipesClosed\n");
|
||||||
|
kill_background_thread = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue