From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: interrupting snd_pcm_writei or snd_pcm_drain? Date: Thu, 15 Nov 2007 12:36:07 +0100 Message-ID: References: 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 999A6244BE for ; Thu, 15 Nov 2007 16:37:02 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Mike Gorse Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Wed, 14 Nov 2007 12:34:07 -0400 (GMT+4), Mike Gorse wrote: > > I've noticed that it is unsafe to call snd_pcm_writei or snd_pcm_drain in > a pthread with its cancelation type set to asynchronous. > snd_pcm_dmix_sync_area can lower a semaphore, and, if the thread is > canceled while the semaphore is down, then a subsequent call to the sound > device (calling snd_pcm_close, for instance) will also lower the semaphore > and cause deadlock. Is this a known issue, and is there a way around it > other than to always use deferred cancelation when calling these > functions? I've not looked deeply through this code flow yet, but it sounds possible that the semaphore gets confused. Did you test any codes indicating that? thanks, Takashi