event/PollGroup: check _WIN32 instead of USE_WINSELECT

This commit is contained in:
Max Kellermann 2020-10-12 12:50:05 +02:00
parent 92fc53ebef
commit 54ee0e28ab
5 changed files with 19 additions and 27 deletions

View File

@ -172,12 +172,8 @@ conf.set('HAVE_PRCTL', is_linux)
conf.set('USE_EVENTFD', is_linux and get_option('eventfd'))
conf.set('USE_SIGNALFD', is_linux and get_option('signalfd'))
if is_windows
conf.set('USE_WINSELECT', true)
elif is_linux and get_option('epoll')
if is_linux and get_option('epoll')
conf.set('USE_EPOLL', true)
else
conf.set('USE_POLL', true)
endif
if not get_option('syslog').disabled()

View File

@ -22,22 +22,24 @@
#include "config.h"
#ifdef USE_EPOLL
#include "PollGroupEpoll.hxx"
typedef PollResultEpoll PollResult;
typedef PollGroupEpoll PollGroup;
#endif
#ifdef _WIN32
#ifdef USE_WINSELECT
#include "PollGroupWinSelect.hxx"
typedef PollResultGeneric PollResult;
typedef PollGroupWinSelect PollGroup;
#endif
#ifdef USE_POLL
#elif defined(USE_EPOLL)
#include "PollGroupEpoll.hxx"
typedef PollResultEpoll PollResult;
typedef PollGroupEpoll PollGroup;
#else
#include "PollGroupPoll.hxx"
typedef PollResultGeneric PollResult;
typedef PollGroupPoll PollGroup;
#endif
#endif

View File

@ -17,10 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#ifdef USE_POLL
#include "PollGroupPoll.hxx"
#include <cassert>
@ -89,5 +85,3 @@ PollGroupPoll::ReadEvents(PollResultGeneric &result, int timeout_ms) noexcept
}
}
}
#endif

View File

@ -17,10 +17,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#ifdef USE_WINSELECT
#include "PollGroupWinSelect.hxx"
static constexpr int EVENT_READ = 0;
@ -165,5 +161,3 @@ PollGroupWinSelect::ReadEvents(PollResultGeneric &result,
i.second.events = 0;
}
}
#endif

View File

@ -4,10 +4,16 @@ if uring_dep.found()
event_sources += 'UringManager.cxx'
endif
if is_windows
event_sources += 'PollGroupWinSelect.cxx'
elif is_linux and get_option('epoll')
# epoll support is header-only
else
event_sources += 'PollGroupPoll.cxx'
endif
event = static_library(
'event',
'PollGroupPoll.cxx',
'PollGroupWinSelect.cxx',
'SignalMonitor.cxx',
'TimerEvent.cxx',
'IdleMonitor.cxx',