Skip to contentSkip to conversation

Closing alsa devices after forking off children

DISCUSSION Werner Van Belle 1 participant 1 message Mar 27, 2009

lore
Share & tools
lore
#0 lore raw

Hello,

I'm currently trying to figure out why a close of the alsa device is not realized 'quickly'. That is it seems to take 2 to 3 seconds before I can reopen the device in anopther program. After observing this behavior somewhat I figured out that opening an alsa device and then forking off a process will keep the alsa device open until the child dies, even when the parent process closes the alsa device.

Is this behavior known and if so how can I work around this ?

I tried to use pthread_atfork to close the device in the forked off child, but that closes the device in the parent process as well, so I would rather want to unlink the device in such a way that the close call does not need to wait until all children have given up their handle.

With kind regards,

Signature · 2 lines
Dr. Werner Van Belle
http://werner.yellowcouch.org/

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel