diff options
author | Max Kellermann <max@duempel.org> | 2014-01-05 22:00:33 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-06 18:27:26 +0100 |
commit | 08f5b9f1f9292a6e9e4a6ede16bb61b38bbae89d (patch) | |
tree | 254e3c5078082c78249c2b1ad568d9eba33f5d89 /src | |
parent | 793962c5b86cd063036a2d28907b0b33012483e1 (diff) | |
download | mpd-08f5b9f1f9292a6e9e4a6ede16bb61b38bbae89d.tar.gz mpd-08f5b9f1f9292a6e9e4a6ede16bb61b38bbae89d.tar.xz mpd-08f5b9f1f9292a6e9e4a6ede16bb61b38bbae89d.zip |
event/MultiSocketMonitor: add method ClearSocketList()
Diffstat (limited to 'src')
-rw-r--r-- | src/event/MultiSocketMonitor.cxx | 9 | ||||
-rw-r--r-- | src/event/MultiSocketMonitor.hxx | 5 | ||||
-rw-r--r-- | src/mixer/AlsaMixerPlugin.cxx | 4 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/event/MultiSocketMonitor.cxx b/src/event/MultiSocketMonitor.cxx index f22b0a022..5ef8b98af 100644 --- a/src/event/MultiSocketMonitor.cxx +++ b/src/event/MultiSocketMonitor.cxx @@ -19,6 +19,7 @@ #include "config.h" #include "MultiSocketMonitor.hxx" +#include "Loop.hxx" #include <algorithm> @@ -35,6 +36,14 @@ MultiSocketMonitor::~MultiSocketMonitor() // TODO } +void +MultiSocketMonitor::ClearSocketList() +{ + assert(GetEventLoop().IsInsideOrNull()); + + fds.clear(); +} + #ifndef WIN32 void diff --git a/src/event/MultiSocketMonitor.hxx b/src/event/MultiSocketMonitor.hxx index 963745be1..150f7baad 100644 --- a/src/event/MultiSocketMonitor.hxx +++ b/src/event/MultiSocketMonitor.hxx @@ -126,6 +126,11 @@ public: } /** + * Remove all sockets. + */ + void ClearSocketList(); + + /** * Update the known sockets by invoking the given function for * each one; its return value is the events bit mask. A * return value of 0 means the socket will be removed from the diff --git a/src/mixer/AlsaMixerPlugin.cxx b/src/mixer/AlsaMixerPlugin.cxx index f0d9b8007..4f92e697d 100644 --- a/src/mixer/AlsaMixerPlugin.cxx +++ b/src/mixer/AlsaMixerPlugin.cxx @@ -91,8 +91,10 @@ static constexpr Domain alsa_mixer_domain("alsa_mixer"); int AlsaMixerMonitor::PrepareSockets() { - if (mixer == nullptr) + if (mixer == nullptr) { + ClearSocketList(); return -1; + } int count = snd_mixer_poll_descriptors_count(mixer); if (count < 0) |