diff options
author | Max Kellermann <max@duempel.org> | 2014-01-05 01:28:36 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-05 01:28:36 +0100 |
commit | 7b540f022699e6e2b2e115d13526e12060a5fc9f (patch) | |
tree | 0fca20b0dc652f8dc5eacb56868c31115d3700ef /src/mixer/AlsaMixerPlugin.cxx | |
parent | e29c22e662d31fb55b0aa4cd071281fca42fabb0 (diff) | |
download | mpd-7b540f022699e6e2b2e115d13526e12060a5fc9f.tar.gz mpd-7b540f022699e6e2b2e115d13526e12060a5fc9f.tar.xz mpd-7b540f022699e6e2b2e115d13526e12060a5fc9f.zip |
event/MultiSocketMonitor: add method ReplaceSocketList()
Move code from AlsaMixerPlugin.
Diffstat (limited to 'src/mixer/AlsaMixerPlugin.cxx')
-rw-r--r-- | src/mixer/AlsaMixerPlugin.cxx | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/src/mixer/AlsaMixerPlugin.cxx b/src/mixer/AlsaMixerPlugin.cxx index 2691f9406..f0d9b8007 100644 --- a/src/mixer/AlsaMixerPlugin.cxx +++ b/src/mixer/AlsaMixerPlugin.cxx @@ -104,24 +104,7 @@ AlsaMixerMonitor::PrepareSockets() if (count < 0) count = 0; - struct pollfd *end = pfds + count; - - UpdateSocketList([pfds, end](int fd) -> unsigned { - auto i = std::find_if(pfds, end, [fd](const struct pollfd &pfd){ - return pfd.fd == fd; - }); - if (i == end) - return 0; - - auto events = i->events; - i->events = 0; - return events; - }); - - for (auto i = pfds; i != end; ++i) - if (i->events != 0) - AddSocket(i->fd, i->events); - + ReplaceSocketList(pfds, count); return -1; } |