From: "Rémi Denis-Courmont" <remi@remlab.net>
To: alsa-devel@alsa-project.org
Cc: Trent Piepho <tpiepho@gmail.com>
Subject: Re: Races in alsa-lib with threads
Date: Wed, 14 Nov 2012 22:03:52 +0200 [thread overview]
Message-ID: <201211142203.52948@leon.remlab.net> (raw)
In-Reply-To: <CA+7tXigU4WhmSFQyUBRmrtZksvwu-4Vj2jsOiN5u6BH9c0itGw@mail.gmail.com>
Hello,
Le mercredi 14 novembre 2012 21:49:36, Trent Piepho a écrit :
> > You claim that the Gstreamer ALSA sink plugin accesses alsa-lib from two
> > threads simultaneously. Could you elaborate on how this can happen, maybe
> > it is easy to fix?
>
> gstreamer has no lock around the call to snd_pcm_delay(). So it can
> race with snd_pcm_wait() or snd_pcm_writei(), which are called in
> another thread. There is a lock around the block of code calling
> wait()/writei(), but this lock isn't used for calling delay().
Use non-blocking I/O and poll(). Then the snd_pcm_write() calls will not sleep
and can be interlocked with snd_pcm_delay() calls.
> It seems that they didn't know there would be a problem.
Eh? It is rather the exception for a library to be thread-safe when using the
same object in multiple threads.
It looks more like "they" did not pay attention to what they were doing.
--
Rémi Denis-Courmont
http://www.remlab.net/
next prev parent reply other threads:[~2012-11-14 20:03 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-10 2:03 Races in alsa-lib with threads Trent Piepho
2012-11-10 13:53 ` Takashi Iwai
2012-11-11 16:35 ` Jaroslav Kysela
2012-11-12 19:40 ` Rob Krakora
2012-11-13 6:32 ` Takashi Iwai
2012-11-13 7:14 ` Trent Piepho
2012-11-13 7:30 ` Takashi Iwai
[not found] ` <5175C6FEA820754B902FF6873E9285B00C985240@039-SN2MPN1-021.039d.mgd.msft.net>
2012-11-13 13:47 ` Krakora Robert-B42341
2012-11-13 13:50 ` Takashi Iwai
2012-11-13 14:04 ` Krakora Robert-B42341
2012-11-13 14:18 ` Takashi Iwai
2012-11-13 14:08 ` Jaroslav Kysela
2012-11-13 14:15 ` Krakora Robert-B42341
2012-11-13 14:19 ` Takashi Iwai
2012-11-13 14:26 ` Krakora Robert-B42341
2012-11-13 19:41 ` Trent Piepho
2012-11-13 20:23 ` Clemens Ladisch
2012-11-13 20:36 ` Trent Piepho
2012-11-13 20:29 ` Takashi Iwai
2012-11-13 20:55 ` Krakora Robert-B42341
2012-11-13 21:11 ` Krakora Robert-B42341
2012-11-13 20:52 ` Krakora Robert-B42341
2012-11-14 8:02 ` David Henningsson
2012-11-14 12:55 ` Krakora Robert-B42341
2012-11-14 19:49 ` Trent Piepho
2012-11-14 20:03 ` Rémi Denis-Courmont [this message]
2012-11-14 20:06 ` Krakora Robert-B42341
2012-11-14 20:54 ` Trent Piepho
2012-11-14 21:19 ` Rémi Denis-Courmont
2012-11-15 1:52 ` Krakora Robert-B42341
2012-11-15 7:39 ` Takashi Iwai
2012-11-15 13:05 ` Krakora Robert-B42341
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201211142203.52948@leon.remlab.net \
--to=remi@remlab.net \
--cc=alsa-devel@alsa-project.org \
--cc=tpiepho@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.