diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2018-10-14 23:36:32 +0900 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2018-10-14 16:57:15 +0200 |
commit | 440ea7d38df6a8b86a5819a42c473c57826f79e4 (patch) | |
tree | b29ca299078a413725cf2a7dc8eeaaf975cf2330 /alsactl/monitor.c | |
parent | af14a2fab0f0fc86ff1b0200ee9208c670bf705d (diff) | |
download | alsa-utils-440ea7d38df6a8b86a5819a42c473c57826f79e4.tar.gz |
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>
Diffstat (limited to 'alsactl/monitor.c')
-rw-r--r-- | alsactl/monitor.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/alsactl/monitor.c b/alsactl/monitor.c index 09ef63c..559fb4c 100644 --- a/alsactl/monitor.c +++ b/alsactl/monitor.c @@ -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); + } } } |