]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fixed typos and made some cleanups in the async stuff
authorJaroslav Kysela <perex@perex.cz>
Thu, 18 Oct 2001 12:33:45 +0000 (12:33 +0000)
committerJaroslav Kysela <perex@perex.cz>
Thu, 18 Oct 2001 12:33:45 +0000 (12:33 +0000)
src/async.c
src/control/control_hw.c
src/pcm/pcm.c
src/pcm/pcm_hw.c

index d1c9e2f9d1a36f391cfc9269f34893bb66ab5315..aea46597ce676a56a25c8092c1bb1da2d2fb2284 100644 (file)
@@ -46,7 +46,7 @@ void snd_async_init(void)
 int snd_async_signo = SIGIO;
 #endif
 
-static struct list_head snd_async_handlers;
+static LIST_HEAD(snd_async_handlers);
 
 static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, void *context ATTRIBUTE_UNUSED)
 {
@@ -56,10 +56,8 @@ static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, vo
        fd = siginfo->si_fd;
        list_for_each(i, &snd_async_handlers) {
                snd_async_handler_t *h = list_entry(i, snd_async_handler_t, glist);
-               if (h->fd == fd) {
+               if (h->fd == fd && h->callback)
                        h->callback(h);
-                       // break;
-               }
        }
 }
 
@@ -88,6 +86,7 @@ int snd_async_add_handler(snd_async_handler_t **handler, int fd,
        if (was_empty) {
                int err;
                struct sigaction act;
+               memset(&act, 0, sizeof(act));
                act.sa_flags = SA_RESTART | SA_SIGINFO;
                act.sa_sigaction = snd_async_handler;
                sigemptyset(&act.sa_mask);
@@ -111,6 +110,7 @@ int snd_async_del_handler(snd_async_handler_t *handler)
        list_del(&handler->glist);
        if (list_empty(&snd_async_handlers)) {
                struct sigaction act;
+               memset(&act, 0, sizeof(act));
                act.sa_flags = 0;
                act.sa_handler = SIG_DFL;
                err = sigaction(snd_async_signo, &act, NULL);
index c206dd2e47a618121fea12eff1ac42445e9bcc3c..df364731744b9d941f7f6a69a33dbc9790aad143 100644 (file)
@@ -90,11 +90,11 @@ static int snd_ctl_hw_async(snd_ctl_t *ctl, int sig, pid_t pid)
        }
        if (sig < 0)
                return 0;
-       if (fcntl(fd, F_SETSIG, sig) < 0) {
+       if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
                SYSERR("F_SETSIG failed");
                return -errno;
        }
-       if (fcntl(fd, F_SETOWN, pid) < 0) {
+       if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
                SYSERR("F_SETOWN failed");
                return -errno;
        }
index 1947163025552778e57d6aa4067828bee9c376d6..6ea8114a6026519da618f7f5ae9144a387ee309d 100644 (file)
@@ -993,7 +993,7 @@ int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,
        was_empty = list_empty(&pcm->async_handlers);
        list_add_tail(&h->hlist, &pcm->async_handlers);
        if (was_empty) {
-               err = snd_pcm_async(pcm, getpid(), snd_async_signo);
+               err = snd_pcm_async(pcm, snd_async_signo, getpid());
                if (err < 0) {
                        snd_async_del_handler(h);
                        return err;
index a0e9a8a32ebe9a3911d0600ec2da0f1fe954d99d..6223f77e5377011dfbca3afcecaf6b7a724d8c9c 100644 (file)
@@ -88,11 +88,11 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
        }
        if (sig < 0)
                return 0;
-       if (fcntl(fd, F_SETSIG, sig) < 0) {
+       if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
                SYSERR("F_SETSIG failed");
                return -errno;
        }
-       if (fcntl(fd, F_SETOWN, pid) < 0) {
+       if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
                SYSERR("F_SETOWN failed");
                return -errno;
        }