mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-22 10:04:39 +00:00
Include wepoll library
This commit is contained in:
parent
840baac1e1
commit
caa38af40b
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -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
|
||||
|
1
externals/wepoll
vendored
Submodule
1
externals/wepoll
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 0598a791bf9cbbf480793d778930fc635b044980
|
@ -10,16 +10,27 @@
|
||||
#include <vector>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <wepoll/wepoll.h>
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#include <sys/epoll.h>
|
||||
#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<std::pair<u32 /*netId*/, OrbisNetEpollEvent>> 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;
|
||||
|
Loading…
Reference in New Issue
Block a user