2021-06-17 14:43:29 +02:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Poller.cc
|
|
|
|
* An Tao
|
|
|
|
*
|
|
|
|
* Public header file in trantor lib.
|
|
|
|
*
|
|
|
|
* Copyright 2018, An Tao. All rights reserved.
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
* that can be found in the License file.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-02-10 01:24:36 +01:00
|
|
|
#include "core/loops/poller.h"
|
2021-06-17 14:43:29 +02:00
|
|
|
#ifdef __linux__
|
2022-02-10 01:24:36 +01:00
|
|
|
#include "poller/epoll_poller.h"
|
2021-06-17 14:43:29 +02:00
|
|
|
#elif defined _WIN32
|
|
|
|
#include "Wepoll.h"
|
2022-02-10 01:24:36 +01:00
|
|
|
#include "poller/epoll_poller.h"
|
2021-06-17 14:43:29 +02:00
|
|
|
#else
|
2022-02-10 01:24:36 +01:00
|
|
|
#include "poller/kqueue.h"
|
2021-06-17 14:43:29 +02:00
|
|
|
#endif
|
|
|
|
using namespace trantor;
|
2021-06-17 14:53:13 +02:00
|
|
|
Poller *Poller::newPoller(EventLoop *loop) {
|
2021-06-17 14:43:29 +02:00
|
|
|
#if defined __linux__ || defined _WIN32
|
2021-06-17 14:53:13 +02:00
|
|
|
return new EpollPoller(loop);
|
2021-06-17 14:43:29 +02:00
|
|
|
#else
|
2021-06-17 14:53:13 +02:00
|
|
|
return new KQueue(loop);
|
2021-06-17 14:43:29 +02:00
|
|
|
#endif
|
|
|
|
}
|