SDL_CloseAudio() taking too long


I’m having a problem using SDL audio and I’m trying to find the cause of it.
The call to SDL_CloseAudio() takes 2 seconds to complete. Is this expected
behavior? For my purpose it is too slow.
In rare cases it doesn’t take almost no time at all.

I found out that the slow down is at the line
in SDL_audio.c .

I use pulseaudio so I went to PULSE_WaitDone() in SDL_pulseaudio.c .
It looks like the program gets stuck inside the while loop.

When it takes 2 seconds, the loop runs 13 times. When it is fast, the loop runs
5 times.

Does somebody knows what the problem could be?

I hope I posted this in the right place…

The fish are biting.
Get more visitors on your site using Yahoo! Search Marketing.