event/MultiSocketMonitor: add method ClearSocketList()
This commit is contained in:
parent
793962c5b8
commit
08f5b9f1f9
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "MultiSocketMonitor.hxx"
|
#include "MultiSocketMonitor.hxx"
|
||||||
|
#include "Loop.hxx"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
@ -35,6 +36,14 @@ MultiSocketMonitor::~MultiSocketMonitor()
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MultiSocketMonitor::ClearSocketList()
|
||||||
|
{
|
||||||
|
assert(GetEventLoop().IsInsideOrNull());
|
||||||
|
|
||||||
|
fds.clear();
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -125,6 +125,11 @@ public:
|
|||||||
fds.emplace_front(*this, fd, events);
|
fds.emplace_front(*this, fd, events);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove all sockets.
|
||||||
|
*/
|
||||||
|
void ClearSocketList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the known sockets by invoking the given function for
|
* Update the known sockets by invoking the given function for
|
||||||
* each one; its return value is the events bit mask. A
|
* each one; its return value is the events bit mask. A
|
||||||
|
@ -91,8 +91,10 @@ static constexpr Domain alsa_mixer_domain("alsa_mixer");
|
|||||||
int
|
int
|
||||||
AlsaMixerMonitor::PrepareSockets()
|
AlsaMixerMonitor::PrepareSockets()
|
||||||
{
|
{
|
||||||
if (mixer == nullptr)
|
if (mixer == nullptr) {
|
||||||
|
ClearSocketList();
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int count = snd_mixer_poll_descriptors_count(mixer);
|
int count = snd_mixer_poll_descriptors_count(mixer);
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user