Hi,
A bug was reported that monitor mode of alsactl consumes much CPU time after disconnection of any sound card[1].
This patchset improves the mode to handle connection/disconnection of sound card. Observed control nodes are maintained by list structure instead of array. Linux specific epoll(7) is used to dispatch events. Linux specific inotify(7) is used to detect connection of new sound card. Linux specific signalfd(2) is used to catch Unix signals for termination.
[1] http://mailman.alsa-project.org/pipermail/alsa-devel/2018-September/140580.h...
Takashi Sakamoto (9): alsactl: split event loop code to a function alsactl: add an iterator of registered instances of sound card alsactl: use epoll(7) instead of poll(2) alsactl: use link list to maintain source of events alsactl: use a list of source for event dispatcher instead of an array of source alsactl: obsolete array for maintenance of handlers alsactl: handle disconnection of sound card alsactl: handle detection of new sound card alsactl: use signalfd to catch UNIX signal
alsactl/monitor.c | 422 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 375 insertions(+), 47 deletions(-)