mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
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)
This commit is contained in:
parent
17d57415f5
commit
9a95fe49c8
9 changed files with 234 additions and 31 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue