daemon: add game_mode_client_ref

Now that GameModeClient is reference counted, the counterpart to
game_mode_client_unref is also needed.
This commit is contained in:
Christian Kellner 2019-07-02 17:23:10 +02:00
parent 7e10cc3a0b
commit d99af40795
2 changed files with 13 additions and 0 deletions

View File

@ -638,6 +638,14 @@ void game_mode_client_unref(GameModeClient *client)
free(client);
}
void game_mode_client_ref(GameModeClient *client)
{
if (!client) {
return;
}
atomic_fetch_add_explicit(&client->refcount, 1, memory_order_seq_cst);
}
/* Internal refresh config function (assumes no contention with reaper thread) */
static void game_mode_reload_config_internal(GameModeContext *self)
{

View File

@ -54,6 +54,11 @@ typedef struct GameModeClient GameModeClient;
*/
void game_mode_client_unref(GameModeClient *client);
/**
* Increment the usage count of client.
*/
void game_mode_client_ref(GameModeClient *client);
/**
* Return the singleton instance
*/