Add try_get_steam_client().

This allows the emulator to attempt to access the global steam_client object
without creating it if it doesn't exist.
This commit is contained in:
redpolline 2024-12-11 16:58:36 -05:00
parent cde29f0fd0
commit 75035de2f4
2 changed files with 11 additions and 0 deletions

View file

@ -140,6 +140,16 @@ Steam_Client *get_steam_client()
return steamclient_instance;
}
Steam_Client *try_get_steam_client()
{
Steam_Client * ret = NULL;
if (global_mutex.try_lock() == true) {
ret = steamclient_instance;
global_mutex.unlock();
}
return ret;
}
void destroy_client()
{
std::lock_guard<std::recursive_mutex> lock(global_mutex);

View file

@ -93,6 +93,7 @@ class GB_CCallbackInterImp : protected CCallbackBase
Steam_Client *get_steam_client();
bool steamclient_has_ipv6_functions();
Steam_Client *try_get_steam_client();
HSteamUser flat_hsteamuser();
HSteamPipe flat_hsteampipe();