summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/source.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2009-08-13 02:14:19 +0200
committerLennart Poettering <lennart@poettering.net>2009-08-13 02:14:19 +0200
commit9a95fe49c848d2711dcdcf4c407e626e41e4657f (patch)
treee2a535e8713aa93a0fbab8486ddf45c4214395db /src/pulsecore/source.h
parent17d57415f5abad5b7c30301227054b4c899bc705 (diff)
core: add assert macros for verifying calling context
This adds pa_assert_io_context() and pa_assert_ctl_context() in addition to a few related macros. When called they will fail when the current execution context is not IO resp. not control context. (aka 'thread' context vs. 'main' context)
Diffstat (limited to 'src/pulsecore/source.h')
-rw-r--r--src/pulsecore/source.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h
index d22e7ca5..001122bc 100644
--- a/src/pulsecore/source.h
+++ b/src/pulsecore/source.h
@@ -43,6 +43,7 @@ typedef struct pa_source pa_source;
#include <pulsecore/source-output.h>
#include <pulsecore/card.h>
#include <pulsecore/queue.h>
+#include <pulsecore/thread-mq.h>
#define PA_MAX_OUTPUTS_PER_SOURCE 32
@@ -295,4 +296,7 @@ void pa_source_set_latency_range_within_thread(pa_source *s, pa_usec_t min_laten
void pa_source_invalidate_requested_latency(pa_source *s);
pa_usec_t pa_source_get_latency_within_thread(pa_source *s);
+#define pa_source_assert_io_context(s) \
+ pa_assert(pa_thread_mq_get() || !PA_SOURCE_IS_LINKED((s)->state))
+
#endif