mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-02 09:01:48 -05:00
Fixed typos and made some cleanups in the async stuff
This commit is contained in:
parent
56778fa89d
commit
67cc9dbc75
4 changed files with 9 additions and 9 deletions
|
|
@ -46,7 +46,7 @@ void snd_async_init(void)
|
||||||
int snd_async_signo = SIGIO;
|
int snd_async_signo = SIGIO;
|
||||||
#endif
|
#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)
|
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;
|
fd = siginfo->si_fd;
|
||||||
list_for_each(i, &snd_async_handlers) {
|
list_for_each(i, &snd_async_handlers) {
|
||||||
snd_async_handler_t *h = list_entry(i, snd_async_handler_t, glist);
|
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);
|
h->callback(h);
|
||||||
// break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,6 +86,7 @@ int snd_async_add_handler(snd_async_handler_t **handler, int fd,
|
||||||
if (was_empty) {
|
if (was_empty) {
|
||||||
int err;
|
int err;
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
|
memset(&act, 0, sizeof(act));
|
||||||
act.sa_flags = SA_RESTART | SA_SIGINFO;
|
act.sa_flags = SA_RESTART | SA_SIGINFO;
|
||||||
act.sa_sigaction = snd_async_handler;
|
act.sa_sigaction = snd_async_handler;
|
||||||
sigemptyset(&act.sa_mask);
|
sigemptyset(&act.sa_mask);
|
||||||
|
|
@ -111,6 +110,7 @@ int snd_async_del_handler(snd_async_handler_t *handler)
|
||||||
list_del(&handler->glist);
|
list_del(&handler->glist);
|
||||||
if (list_empty(&snd_async_handlers)) {
|
if (list_empty(&snd_async_handlers)) {
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
|
memset(&act, 0, sizeof(act));
|
||||||
act.sa_flags = 0;
|
act.sa_flags = 0;
|
||||||
act.sa_handler = SIG_DFL;
|
act.sa_handler = SIG_DFL;
|
||||||
err = sigaction(snd_async_signo, &act, NULL);
|
err = sigaction(snd_async_signo, &act, NULL);
|
||||||
|
|
|
||||||
|
|
@ -90,11 +90,11 @@ static int snd_ctl_hw_async(snd_ctl_t *ctl, int sig, pid_t pid)
|
||||||
}
|
}
|
||||||
if (sig < 0)
|
if (sig < 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (fcntl(fd, F_SETSIG, sig) < 0) {
|
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
|
||||||
SYSERR("F_SETSIG failed");
|
SYSERR("F_SETSIG failed");
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
if (fcntl(fd, F_SETOWN, pid) < 0) {
|
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
|
||||||
SYSERR("F_SETOWN failed");
|
SYSERR("F_SETOWN failed");
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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);
|
was_empty = list_empty(&pcm->async_handlers);
|
||||||
list_add_tail(&h->hlist, &pcm->async_handlers);
|
list_add_tail(&h->hlist, &pcm->async_handlers);
|
||||||
if (was_empty) {
|
if (was_empty) {
|
||||||
err = snd_pcm_async(pcm, getpid(), snd_async_signo);
|
err = snd_pcm_async(pcm, snd_async_signo, getpid());
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
snd_async_del_handler(h);
|
snd_async_del_handler(h);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
||||||
|
|
@ -88,11 +88,11 @@ static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
|
||||||
}
|
}
|
||||||
if (sig < 0)
|
if (sig < 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (fcntl(fd, F_SETSIG, sig) < 0) {
|
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
|
||||||
SYSERR("F_SETSIG failed");
|
SYSERR("F_SETSIG failed");
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
if (fcntl(fd, F_SETOWN, pid) < 0) {
|
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
|
||||||
SYSERR("F_SETOWN failed");
|
SYSERR("F_SETOWN failed");
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue