diff --git a/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c b/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c index b298cf713..9f71184e5 100644 --- a/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c +++ b/src/hostapi/pulseaudio/pa_linux_pulseaudio_cb.c @@ -119,12 +119,15 @@ void PaPulseAudio_ReleaseOperation(PaPulseAudio_HostApiRepresentation *hostapi, while( waitOperation > 0 ) { - PaPulseAudio_Lock( hostapi->mainloop ); - pa_threaded_mainloop_wait( hostapi->mainloop ); - PaPulseAudio_UnLock( hostapi->mainloop ); - localOperationState = pa_operation_get_state( localOperation ); + if( localOperationState == PA_OPERATION_RUNNING ) + { + PaPulseAudio_Lock( hostapi->mainloop ); + pa_threaded_mainloop_wait( hostapi->mainloop ); + PaPulseAudio_UnLock( hostapi->mainloop ); + } + // No wait if operation have been DONE or CANCELLED if( localOperationState != PA_OPERATION_RUNNING) {