diff --git a/.gitmodules b/.gitmodules index 25b5d307b..6be16956c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -106,3 +106,6 @@ [submodule "externals/libusb"] path = externals/libusb url = https://github.com/libusb/libusb-cmake.git +[submodule "externals/wepoll"] + path = externals/wepoll + url = https://github.com/piscisaureus/wepoll.git diff --git a/externals/wepoll b/externals/wepoll new file mode 160000 index 000000000..0598a791b --- /dev/null +++ b/externals/wepoll @@ -0,0 +1 @@ +Subproject commit 0598a791bf9cbbf480793d778930fc635b044980 diff --git a/src/core/libraries/network/net_epoll.h b/src/core/libraries/network/net_epoll.h index 5363efff0..bd2117058 100644 --- a/src/core/libraries/network/net_epoll.h +++ b/src/core/libraries/network/net_epoll.h @@ -10,16 +10,27 @@ #include #include +#ifdef _WIN32 +#include +#endif + #ifdef __linux__ #include +#define epoll_close close #endif namespace Libraries::Net { +#ifdef _WIN32 +using epoll_handle = HANDLE; +#elif defined(__linux__) +using epoll_handle = int; +#endif + struct Epoll { std::vector> events{}; const char* name; - int epoll_fd; + epoll_handle epoll_fd; explicit Epoll(const char* name_) : name(name_), epoll_fd(epoll_create1(0)) { ASSERT(epoll_fd != -1); @@ -31,7 +42,7 @@ struct Epoll { void Destroy() noexcept { events.clear(); - close(epoll_fd); + epoll_close(epoll_fd); epoll_fd = -1; name = nullptr; destroyed = true;