From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] pcm_hw: Respect LIBASOUND_THREAD_SAFE env var Date: Thu, 01 Sep 2016 08:51:14 +0200 Message-ID: References: <1472710010-16951-1-git-send-email-diwic@ubuntu.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id F2D262666DA for ; Thu, 1 Sep 2016 08:51:15 +0200 (CEST) In-Reply-To: <1472710010-16951-1-git-send-email-diwic@ubuntu.com> 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: David Henningsson Cc: samuel.thibault@ens-lyon.org, alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org On Thu, 01 Sep 2016 08:06:50 +0200, David Henningsson wrote: > > Without this patch, there no way to revert to the old > behaviour with pcm_hw, so currently there will always > be some extra locking. > > This seems to be an oversight? thread_safe=1 means that the plugin needs no locking, so it means hw PCM never takes a lock by itself. Only other plugins do, and it's suppressed when $LIBASOUND_THREAD_SAFE=0 is passed. The flag needs a better description or a better name... Takashi > Reported-by: Samuel Thibault > Signed-off-by: David Henningsson > --- > src/pcm/pcm_hw.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c > index 3a5634c..e6a8a4f 100644 > --- a/src/pcm/pcm_hw.c > +++ b/src/pcm/pcm_hw.c > @@ -1514,7 +1514,8 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp, const char *name, > pcm->poll_events = info.stream == SND_PCM_STREAM_PLAYBACK ? POLLOUT : POLLIN; > pcm->tstamp_type = tstamp_type; > #ifdef THREAD_SAFE_API > - pcm->thread_safe = 1; > + if (pcm->thread_safe != -1) > + pcm->thread_safe = 1; > #endif > > ret = snd_pcm_hw_mmap_status(pcm); > -- > 1.9.1 >