From a3162a396e2344b9e48fe27e406e5d92ba94af9b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 23 Jan 2009 22:29:02 +0100 Subject: [PATCH] maintain a pa_core state variable --- src/pulsecore/core.c | 5 +++++ src/pulsecore/core.h | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 0b78bc4..c6e96c1 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -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.process_msg = core_process_msg; + c->state = PA_CORE_STARTUP; c->mainloop = m; c->clients = 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); + c->state = PA_CORE_RUNNING; + return c; } @@ -157,6 +160,8 @@ static void core_free(pa_object *o) { int j; pa_assert(c); + c->state = PA_CORE_SHUTDOWN; + pa_module_unload_all(c); pa_assert(!c->modules); diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h index 9f463d6..a91d752 100644 --- a/src/pulsecore/core.h +++ b/src/pulsecore/core.h @@ -41,6 +41,12 @@ typedef struct pa_core pa_core; #include #include +typedef enum pa_core_state { + PA_CORE_STARTUP, + PA_CORE_RUNNING, + PA_CORE_SHUTDOWN +} pa_core_state_t; + typedef enum pa_core_hook { PA_CORE_HOOK_SINK_NEW, PA_CORE_HOOK_SINK_FIXATE, @@ -92,6 +98,8 @@ typedef enum pa_core_hook { struct pa_core { pa_msgobject parent; + pa_core_state_t state; + /* A random value which may be used to identify this instance of * PulseAudio. Not cryptographically secure in any way. */ uint32_t cookie; -- 2.7.4