* ALSA async callback re-enter and DEADLOCK.
@ 2012-03-23 23:22 Павел Колодин
[not found] ` <4F7181D7.5040203@ladisch.de>
0 siblings, 1 reply; 2+ messages in thread
From: Павел Колодин @ 2012-03-23 23:22 UTC (permalink / raw)
To: alsa-devel
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!
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: ALSA async callback re-enter and DEADLOCK.
[not found] ` <CACwG4MRqtvN31XsvzxOCq3c7nab8NxJKVguYojOzkeP9THq8XQ@mail.gmail.com>
@ 2012-03-27 12:40 ` Clemens Ladisch
0 siblings, 0 replies; 2+ messages in thread
From: Clemens Ladisch @ 2012-03-27 12:40 UTC (permalink / raw)
To: Павел Колодин
Cc: alsa-devel
Павел Колодин wrote:
> So, in multi-threaded appliction, the better solution would be to start separate thread that would talk with ALSA only?
Yes. If you already have a poll()-based event loop in some thread,
it might make sense to put the ALSA code there, but this depends on
how these threads affect each other.
Regards,
Clemens
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-03-27 12:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-23 23:22 ALSA async callback re-enter and DEADLOCK Павел Колодин
[not found] ` <4F7181D7.5040203@ladisch.de>
[not found] ` <CACwG4MRqtvN31XsvzxOCq3c7nab8NxJKVguYojOzkeP9THq8XQ@mail.gmail.com>
2012-03-27 12:40 ` Clemens Ladisch
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.