system/EPollFD: rename to EpollFD

This commit is contained in:
Max Kellermann 2018-08-22 15:31:19 +02:00
parent b1390ec27f
commit dd461400fb
5 changed files with 21 additions and 21 deletions

View File

@ -619,7 +619,7 @@ libsystem_a_SOURCES = \
src/system/EventPipe.cxx src/system/EventPipe.hxx \
src/system/EventFD.cxx src/system/EventFD.hxx \
src/system/SignalFD.cxx src/system/SignalFD.hxx \
src/system/EPollFD.cxx src/system/EPollFD.hxx \
src/system/EpollFD.cxx src/system/EpollFD.hxx \
src/system/PeriodClock.hxx \
src/system/Clock.cxx src/system/Clock.hxx
@ -628,7 +628,7 @@ libsystem_a_SOURCES = \
libevent_a_SOURCES = \
src/event/WakeFD.hxx \
src/event/PollGroup.hxx \
src/event/PollGroupEPoll.hxx \
src/event/PollGroupEpoll.hxx \
src/event/PollGroupPoll.hxx src/event/PollGroupPoll.cxx \
src/event/PollGroupWinSelect.hxx src/event/PollGroupWinSelect.cxx \
src/event/PollResultGeneric.hxx \

View File

@ -21,9 +21,9 @@
#define MPD_EVENT_POLLGROUP_HXX
#ifdef USE_EPOLL
#include "PollGroupEPoll.hxx"
typedef PollResultEPoll PollResult;
typedef PollGroupEPoll PollGroup;
#include "PollGroupEpoll.hxx"
typedef PollResultEpoll PollResult;
typedef PollGroupEpoll PollGroup;
#endif
#ifdef USE_WINSELECT

View File

@ -23,14 +23,14 @@
#include "check.h"
#include "util/Compiler.h"
#include "system/EPollFD.hxx"
#include "system/EpollFD.hxx"
#include <array>
#include <algorithm>
class PollResultEPoll
class PollResultEpoll
{
friend class PollGroupEPoll;
friend class PollGroupEpoll;
std::array<epoll_event, 16> events;
size_t n_events = 0;
@ -59,21 +59,21 @@ public:
}
};
class PollGroupEPoll
class PollGroupEpoll
{
EPollFD epoll;
EpollFD epoll;
PollGroupEPoll(PollGroupEPoll &) = delete;
PollGroupEPoll &operator=(PollGroupEPoll &) = delete;
PollGroupEpoll(PollGroupEpoll &) = delete;
PollGroupEpoll &operator=(PollGroupEpoll &) = delete;
public:
static constexpr unsigned READ = EPOLLIN;
static constexpr unsigned WRITE = EPOLLOUT;
static constexpr unsigned ERROR = EPOLLERR;
static constexpr unsigned HANGUP = EPOLLHUP;
PollGroupEPoll() = default;
PollGroupEpoll() = default;
void ReadEvents(PollResultEPoll &result, int timeout_ms) noexcept {
void ReadEvents(PollResultEpoll &result, int timeout_ms) noexcept {
int ret = epoll.Wait(result.events.data(), result.events.size(),
timeout_ms);
result.n_events = std::max(0, ret);

View File

@ -19,10 +19,10 @@
#include "config.h"
#ifdef USE_EPOLL
#include "EPollFD.hxx"
#include "EpollFD.hxx"
#include "Error.hxx"
EPollFD::EPollFD()
EpollFD::EpollFD()
:fd(::epoll_create1(EPOLL_CLOEXEC))
{
if (fd < 0)

View File

@ -32,23 +32,23 @@ struct epoll_event;
/**
* A class that wraps Linux epoll.
*/
class EPollFD {
class EpollFD {
const int fd;
public:
/**
* Throws on error.
*/
EPollFD();
EpollFD();
~EPollFD() noexcept {
~EpollFD() noexcept {
assert(fd >= 0);
::close(fd);
}
EPollFD(const EPollFD &other) = delete;
EPollFD &operator=(const EPollFD &other) = delete;
EpollFD(const EpollFD &other) = delete;
EpollFD &operator=(const EpollFD &other) = delete;
int Wait(epoll_event *events, int maxevents, int timeout) noexcept {
return ::epoll_wait(fd, events, maxevents, timeout);