At Thu, 12 Aug 2010 23:24:43 +0200,
Jiri Slaby wrote:
And the below is a minimal test case to simulate the situation
PulseAudio does.
Takashi
===
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/inotify.h>
#include <unistd.h>
int main()
{
int fd;
inotify_add_watch(inotify_init(), "/dev/snd", IN_CLOSE_WRITE);
fd = open("/dev/snd/pcmC0D0p", O_RDWR | O_NONBLOCK);
if (fd < 0)
perror("open1");
else
close(fd);
fd = open("/dev/snd/pcmC0D0p", O_RDWR | O_NONBLOCK);
if (fd < 0)
perror("open2");
else
close(fd);
return 0;
}
--