[alsa-devel] ALSA async callback re-enter and DEADLOCK.
Hello.
I've implemented a simple application using this example: http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_8c-example.html (see "async_callback()", line 390).
My problem is that sometimes (after 1 or 20 mins of playing sound (unpredictable) everything just hangs - similarly to deadlock. I have found that callback is called WHILE another callback function is still executed (not returned yet). My debug code is like:
void async_callback(snd_async_handler_t *ahandler) { std::cout << "?"; std::cout.flush(); // some code with snd_async_handler_get_callback_private(), snd_pcm_avail_update(), snd_pcm_writei() and so on // std::cout << "!"; std::cout.flush(); return; }
Everything is ok when i see "?!?!?!...", but if "??" occurs than app goes into an eternal deadlock.
I work with ALSA literally as in that example - settings (HW and SW) are the same. Soundcard is "Analog Devices AD1981", ALSA version is 1.0.19. I do fill buffer until there is a place for periods and hear 44100/16/2channels sound without any clicks and noises before "??" occurs.
Sorry for poor english; from Siberia with love. Thank you!
participants (1)
-
Павел Колодин