mirror of
https://github.com/FeralInteractive/gamemode.git
synced 2025-06-07 08:07:20 +02:00
daemon: make context_num_clients a public method
So it can be used from outside daemon/gamemode.c, to e.g. implement an ClientCount property.
This commit is contained in:
parent
e86580c18c
commit
6d921617f9
@ -89,7 +89,6 @@ static volatile bool had_context_init = false;
|
|||||||
static GameModeClient *game_mode_client_new(pid_t pid, char *exe);
|
static GameModeClient *game_mode_client_new(pid_t pid, char *exe);
|
||||||
static void game_mode_client_free(GameModeClient *client);
|
static void game_mode_client_free(GameModeClient *client);
|
||||||
static const GameModeClient *game_mode_context_has_client(GameModeContext *self, pid_t client);
|
static const GameModeClient *game_mode_context_has_client(GameModeContext *self, pid_t client);
|
||||||
static int game_mode_context_num_clients(GameModeContext *self);
|
|
||||||
static void *game_mode_context_reaper(void *userdata);
|
static void *game_mode_context_reaper(void *userdata);
|
||||||
static void game_mode_context_enter(GameModeContext *self);
|
static void game_mode_context_enter(GameModeContext *self);
|
||||||
static void game_mode_context_leave(GameModeContext *self);
|
static void game_mode_context_leave(GameModeContext *self);
|
||||||
@ -316,10 +315,7 @@ static const GameModeClient *game_mode_context_has_client(GameModeContext *self,
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
int game_mode_context_num_clients(GameModeContext *self)
|
||||||
* Helper to grab the current number of clients we know about
|
|
||||||
*/
|
|
||||||
static int game_mode_context_num_clients(GameModeContext *self)
|
|
||||||
{
|
{
|
||||||
return atomic_load(&self->refcount);
|
return atomic_load(&self->refcount);
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,13 @@ void game_mode_context_init(GameModeContext *self);
|
|||||||
*/
|
*/
|
||||||
void game_mode_context_destroy(GameModeContext *self);
|
void game_mode_context_destroy(GameModeContext *self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Query the number of currently registered clients.
|
||||||
|
*
|
||||||
|
* @returns The number of clients. A number > 0 means that gamemode is active.
|
||||||
|
*/
|
||||||
|
int game_mode_context_num_clients(GameModeContext *self);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a new game client with the context
|
* Register a new game client with the context
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user