* interrupting snd_pcm_writei or snd_pcm_drain?
@ 2007-11-14 16:34 Mike Gorse
2007-11-15 11:36 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Mike Gorse @ 2007-11-14 16:34 UTC (permalink / raw)
To: alsa-devel
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?
Thanks,
-Mike G-
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: interrupting snd_pcm_writei or snd_pcm_drain?
2007-11-14 16:34 interrupting snd_pcm_writei or snd_pcm_drain? Mike Gorse
@ 2007-11-15 11:36 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2007-11-15 11:36 UTC (permalink / raw)
To: Mike Gorse; +Cc: alsa-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-11-15 15:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-14 16:34 interrupting snd_pcm_writei or snd_pcm_drain? Mike Gorse
2007-11-15 11:36 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox