summaryrefslogtreecommitdiffstats
path: root/src/pulsecore/thread-mq.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/thread-mq.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/thread-mq.h')
-rw-r--r--src/pulsecore/thread-mq.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pulsecore/thread-mq.h b/src/pulsecore/thread-mq.h
index 3b5e0e78..96839d25 100644
--- a/src/pulsecore/thread-mq.h
+++ b/src/pulsecore/thread-mq.h
@@ -45,4 +45,12 @@ void pa_thread_mq_install(pa_thread_mq *q);
/* Return the pa_thread_mq object that is set for the current thread */
pa_thread_mq *pa_thread_mq_get(void);
+/* Verify that we are in control context (aka 'main context'). */
+#define pa_assert_ctl_context(s) \
+ pa_assert(!pa_thread_mq_get())
+
+/* Verify that we are in IO context (aka 'thread context'). */
+#define pa_assert_io_context(s) \
+ pa_assert(pa_thread_mq_get())
+
#endif