From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jaroslav Kysela Subject: Re: Races in alsa-lib with threads Date: Tue, 13 Nov 2012 15:08:29 +0100 Message-ID: <50A2545D.4090106@perex.cz> References: <509FD3BE.7090504@perex.cz> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail1.perex.cz (mail1.perex.cz [77.48.224.245]) by alsa0.perex.cz (Postfix) with ESMTP id CA3A9265176 for ; Tue, 13 Nov 2012 15:08:30 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Takashi Iwai Cc: "alsa-devel@alsa-project.org" , Trent Piepho , Krakora Robert-B42341 List-Id: alsa-devel@alsa-project.org Date 13.11.2012 14:50, Takashi Iwai wrote: > At Tue, 13 Nov 2012 13:39:24 +0000, Krakora Robert-B42341 wrote: >> >> [1 ] >>> From: Takashi Iwai [tiwai@suse.de] Sent: Tuesday, November 13, >>> 2012 2:30 AM To: Trent Piepho Cc: Krakora Robert-B42341; >>> alsa-devel@alsa-project.org Subject: Re: [alsa-devel] Races in >>> alsa-lib with threads >>> >>> At Tue, 13 Nov 2012 02:14:08 -0500, Trent Piepho wrote: >>>> >>>> On Tue, Nov 13, 2012 at 1:32 AM, Takashi Iwai >>>> wrote: >>>>> At Mon, 12 Nov 2012 19:40:42 +0000 (UTC), Rob Krakora wrote: >>>>>> 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 way :) >>>> >>>> >>>> The introduction on the alsa-project home page says, "SMP and >>>> thread-safe design. " Some people might misunderstand what >>>> thread-safe means. Maybe some clarification could be added. >>>> "Different streams are SMP and thread-safe (calls for the same >>>> stream must be serialized)." >>> >>> Yeah this should be corrected. SMP things are just about the >>> kernel side at that time. >>> >>> It's a Wiki, feel free to correct / improve the text. >>> >>> >>> Takashi >> >> Hi Takashi, >> >> The way that the GStreamer ALSA Sink Plugin is using ALSA Lib >> assumes that it is thread safe. The fix crafted by one of Trent's >> colleagues (attached) seems to be the way to go. However, I don't >> know how it would impact other functionality within ALSA Lib. > > No, sorry, we don't want to introduce pthread_lock in alsa-lib PCM > stuff. > > We already have a few places, yes, but they are exceptional (mostly > for funky rarely used plugins that we can drop or mixer codes that > are no hot path). I tried to put notes on the ALSA Wiki, please, extend / fix / review. http://www.alsa-project.org/main/index.php/SMP_Design Jaroslav -- Jaroslav Kysela Linux Kernel Sound Maintainer ALSA Project; Red Hat, Inc.