From aa1cfb046f93b18db4d12986ddbff84cbaa952cb Mon Sep 17 00:00:00 2001 From: Tuukka Pasanen Date: Sun, 24 Nov 2024 10:55:06 +0200 Subject: [PATCH] Pulseaudio: Debug print if we are in main thread As documentation says: This function may not be called inside the event loop thread. Events that are dispatched from the event loop thread are executed with this lock held. Add small debug print that makes sure that future code won't be calling it from main thread. --- src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c b/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c index 92fdb5365..4c86c7d57 100644 --- a/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c +++ b/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c @@ -158,6 +158,12 @@ void PaPulseAudio_Lock( pa_threaded_mainloop *mainloop ) if( !pa_threaded_mainloop_in_thread( mainloop ) ) { pa_threaded_mainloop_lock( mainloop ); } + else + { + PA_DEBUG( ("Portaudio %s: Called from event loop thread as value is: %d (not locked)\n", + __FUNCTION__, + pa_threaded_mainloop_in_thread( mainloop )) ); + } } /* unlocks the Pulse Main loop when not called from it */ @@ -166,6 +172,12 @@ void PaPulseAudio_UnLock( pa_threaded_mainloop *mainloop ) if( !pa_threaded_mainloop_in_thread( mainloop ) ) { pa_threaded_mainloop_unlock( mainloop ); } + else + { + PA_DEBUG( ("Portaudio %s: Called from event loop thread as value is: %d (not unlocked)\n", + __FUNCTION__, + pa_threaded_mainloop_in_thread( mainloop )) ); + } } void _PaPulseAudio_WriteRingBuffer( PaUtilRingBuffer *ringbuffer,