maintain a pa_core state variable

This commit is contained in:
Lennart Poettering 2009-01-23 22:29:02 +01:00
parent 88c9f9fba6
commit a3162a396e
2 changed files with 13 additions and 0 deletions

View file

@ -90,6 +90,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) {
c->parent.parent.free = core_free; c->parent.parent.free = core_free;
c->parent.process_msg = core_process_msg; c->parent.process_msg = core_process_msg;
c->state = PA_CORE_STARTUP;
c->mainloop = m; c->mainloop = m;
c->clients = pa_idxset_new(NULL, NULL); c->clients = pa_idxset_new(NULL, NULL);
c->sinks = pa_idxset_new(NULL, NULL); c->sinks = pa_idxset_new(NULL, NULL);
@ -149,6 +150,8 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) {
pa_core_check_idle(c); pa_core_check_idle(c);
c->state = PA_CORE_RUNNING;
return c; return c;
} }
@ -157,6 +160,8 @@ static void core_free(pa_object *o) {
int j; int j;
pa_assert(c); pa_assert(c);
c->state = PA_CORE_SHUTDOWN;
pa_module_unload_all(c); pa_module_unload_all(c);
pa_assert(!c->modules); pa_assert(!c->modules);

View file

@ -41,6 +41,12 @@ typedef struct pa_core pa_core;
#include <pulsecore/sink-input.h> #include <pulsecore/sink-input.h>
#include <pulsecore/msgobject.h> #include <pulsecore/msgobject.h>
typedef enum pa_core_state {
PA_CORE_STARTUP,
PA_CORE_RUNNING,
PA_CORE_SHUTDOWN
} pa_core_state_t;
typedef enum pa_core_hook { typedef enum pa_core_hook {
PA_CORE_HOOK_SINK_NEW, PA_CORE_HOOK_SINK_NEW,
PA_CORE_HOOK_SINK_FIXATE, PA_CORE_HOOK_SINK_FIXATE,
@ -92,6 +98,8 @@ typedef enum pa_core_hook {
struct pa_core { struct pa_core {
pa_msgobject parent; pa_msgobject parent;
pa_core_state_t state;
/* A random value which may be used to identify this instance of /* A random value which may be used to identify this instance of
* PulseAudio. Not cryptographically secure in any way. */ * PulseAudio. Not cryptographically secure in any way. */
uint32_t cookie; uint32_t cookie;