[alsa-devel] [PATCH] alsa-lib: snd_pcm_delay and friends do not account for a write being currently in progress

Clemens Ladisch clemens at ladisch.de
Thu Jun 3 16:48:29 CEST 2010


John Lindgren wrote:
> On Thu, 2010-06-03 at 08:40 +0200, Clemens Ladisch wrote:
> > Alsa-lib is not thread safe.
> 
> From http://alsa-project.org/main/index.php/Main_Page:
> 
>         ALSA has the following significant features:
>         ...
>         SMP and thread-safe design.
> 
> So, that's a big lie?

That applies to the kernel code.

Most functions in alsa-lib must not be called at the same time on the
same device handle.  (Don't ask me where this is documented.)

> > ... poll()
> 
> Would it work to simply call snd_pcm_wait?

Yes.  (I usually suggest poll because the code that writes audio data
often wants to be informed of some other event.  If your writing loop
doesn't need to be interrupted, snd_pcm_wait works just fine.)


Regards,
Clemens


More information about the Alsa-devel mailing list