[alsa-devel] Should snd_pcm_drop() interrupt snd_pcm_writei() call?

Marek Peca marek at duch.cz
Tue May 12 18:46:03 CEST 2009


I would like to know, how should snd_pcm_drop() call influence 
snd_pcm_writei() being simultaneously executed.

I expected, that after issuing snd_pcm_drop() (from another thread), the 
snd_pcm_write*() in progress should be terminated almost immediately with 
some return value (error or short write). According to my observation, 
this seem to work on ALSA lib & driver 1.0.14rc3, snd_ali5451.

However, it never or almost never works on another machine with ALSA lib 
1.0.16 (Debian package libasound2 [1.0.16-2], driver unknown, sorry).
There, the snd_pcm_write*() _never_returns_ after snd_pcm_drop(), and 
remain stuck forever.

I would like to ask you, which behaviour of snd_pcm_drop/snd_pcm_write* is 
the correct one. I suppose the snd_pcm_write*() should be interrupted, 
otherwise, an extra thread would be needed in many applications. However, 
I don't know, why does not it work in the later version of ALSA.

I have not found the answer in Doxygen, and since I am real ALSA newbie, I 
gave up reading ALSA source, especially because I have seen different 
behaviour among two different versions. Excuse my impatience.

Thank you for a clarification.
Best regards,

More information about the Alsa-devel mailing list