[alsa-devel] Races in alsa-lib with threads
tiwai at suse.de
Tue Nov 13 07:32:09 CET 2012
At Mon, 12 Nov 2012 19:40:42 +0000 (UTC),
Rob Krakora wrote:
> 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.
Think other way round:
The fact that it isn't documented means it's not safe to use in that
More information about the Alsa-devel