Skip to content

Commit

Permalink
Pulseaudio: Debug print if we are in main thread
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
illuusio committed Nov 24, 2024
1 parent 758d5a4 commit 80b1168
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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,
Expand Down

0 comments on commit 80b1168

Please sign in to comment.