Fix blocking during draining in dmix

Fix the blocking during draining in dmix plugin due to ioctl
conflicts (bug #1074).  This is a temporary workaround.
This commit is contained in:
Takashi Iwai 2005-05-15 13:54:00 +00:00
parent 10557ca6b9
commit 1aaf4a50af

View file

@ -35,6 +35,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/poll.h>
#include <sys/shm.h> #include <sys/shm.h>
#include <sys/sem.h> #include <sys/sem.h>
#include <sys/wait.h> #include <sys/wait.h>
@ -418,16 +419,19 @@ int snd_pcm_direct_async(snd_pcm_t *pcm, int sig, pid_t pid)
/* empty the timer read queue */ /* empty the timer read queue */
void snd_pcm_direct_clear_timer_queue(snd_pcm_direct_t *dmix) void snd_pcm_direct_clear_timer_queue(snd_pcm_direct_t *dmix)
{ {
/* rbuf might be overwriten by multiple plugins */ struct pollfd fds[4];
/* we don't need the value */ int fdn = snd_timer_poll_descriptors(dmix->timer, fds, 4);
if (dmix->tread) {
snd_timer_tread_t rbuf; while (poll(fds, fdn, 0) > 0) {
while (snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf)) == sizeof(rbuf)) /* rbuf might be overwriten by multiple plugins */
; /* we don't need the value */
} else { if (dmix->tread) {
snd_timer_read_t rbuf; snd_timer_tread_t rbuf;
while (snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf)) == sizeof(rbuf)) snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf));
; } else {
snd_timer_read_t rbuf;
snd_timer_read(dmix->timer, &rbuf, sizeof(rbuf));
}
} }
} }