mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 22:16:34 +01:00
alsactl: handle disconnection of sound card
Once sound card becomes disconnection state, corresponding control node becomes to emit error event for listeners. When catching this type of event, event dispatcher should stop observation of the node. However, at present, a mode of monitor can't handle this correctly. As a result, poll(2) is executed quite frequently in loop with no wait. This results 100% consumption of CPU time. This commit takes the dispatcher to remove the node from observation list when detecting the disconnection state. Reported-by: Thomas Gläßle <thomas@coldfix.de> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
parent
af14a2fab0
commit
440ea7d38d
1 changed files with 4 additions and 0 deletions
|
@ -285,6 +285,10 @@ static int run_dispatcher(int epfd, struct list_head *srcs)
|
|||
struct src_entry *entry = (struct src_entry *)ev->data.ptr;
|
||||
if (ev->events & EPOLLIN)
|
||||
print_event(entry->handle, entry->name);
|
||||
if (ev->events & EPOLLERR) {
|
||||
operate_dispatcher(epfd, EPOLL_CTL_DEL, NULL, entry);
|
||||
remove_source_entry(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue