[alsa-devel] Races in alsa-lib with threads

Rob Krakora B42341 at freescale.com
Mon Nov 12 20:40:42 CET 2012

Jaroslav Kysela <perex <at> perex.cz> writes:

> Date 10.11.2012 14:53, Takashi Iwai wrote:
> > At Fri, 9 Nov 2012 18:03:25 -0800,
> > Trent Piepho wrote:
> >>
> >> We've found a race with alsa-lib functions are called from multiple
> >> threads.  I was under the impression that alsa-lib was supposed to be
> >> thread safe.  Is this not the case and all alsa calls should be done
> >> one from thread or protected by a mutex?
> > 
> > Yes.  alsa-lib isn't thread-safe.
> The alsa-lib is designed to be thread safe but the calls for one handle
> (PCM, control, rawmidi etc.) should be serialized using mutexes in apps.
> Or basically, it's assumed that one thread will maintain one handle.
> This should be documented somewhere.
> 					Jaroslav

Hi Jaroslav,

Would you be able to point me the the ALSA documentation that indicates the
stipulations on handle usage using multiple threads?  I cannot find it.

Best Regards,

Rob Krakora

More information about the Alsa-devel mailing list