[alsa-devel] Third time: Unlink PCM resource ?

Jaroslav Kysela perex at perex.cz
Mon May 25 23:54:09 CEST 2009

On Mon, 25 May 2009, Werner Van Belle wrote:

> Jaroslav Kysela wrote:
>> The question is if it's not better to free also allocated memory
>> associated to the pcm handle in child process - so snd_pcm_close()
>> call in child is not a bad idea.
> Okay, while you both have been discussing some internals, which I didn't
> try yet, I created a demonstration program to illustrate the mixed
> semantics of the 'sharing' versus 'not sharing' behavior of the dsp
> devices. In the example the parent thread will play a sound, then the
> child closes the dsp, which affects the playback in the parent (it
> either hangs or skips all remaining samples). From this one would
> conclude that the pcm device is fully shared between the two processes
> (semantics I can live with). However, when the parent then tries to
> reopen the device it cannot do so because the device is still 'busy'.

Your example program does not contain dsp_close() call in parent before 
dsp_open(). That's reason why PCM device is blocked.


Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

More information about the Alsa-devel mailing list