왠지 버그 고쳐짐..

This commit is contained in:
2025-05-09 23:31:25 +09:00
parent 74e73ccc23
commit 20f8c7b29d
3 changed files with 9 additions and 5 deletions

View File

@@ -253,8 +253,8 @@ public:
log::critical("CreateIoCompletionPort()");
#elif __linux__
epollfd_ = ::epoll_create(1);
epollDetroyerFd_ = ::eventfd(0, EFD_NONBLOCK);
::epoll_ctl(epollfd_, EPOLL_CTL_ADD, epollDetroyerFd_, NULL);
epollDetroyerFd = ::eventfd(0, EFD_NONBLOCK);
::epoll_ctl(epollfd_, EPOLL_CTL_ADD, epollDetroyerFd, NULL);
#endif
auto boundFunc = [callback = std::move(callback)](ThreadPool* __IOCPThread, IOCPPASSINDATA* data) mutable {
callback(__IOCPThread, data);
@@ -285,6 +285,10 @@ public:
int recv(IOCPPASSINDATA* data, int bufferCount);
int send(IOCPPASSINDATA* data, int bufferCount, int __flags, bool client = false);
#ifdef __linux__
int epollDetroyerFd = -1;
#endif
private:
struct WSAManager wsaManager;
ThreadPool* IOCPThread_;
@@ -293,7 +297,6 @@ private:
HANDLE completionPort_ = INVALID_HANDLE_VALUE;
#elif __linux__
int epollfd_ = -1;
int epollDetroyerFd_ = -1;
std::unordered_map<std::shared_ptr<TCPSocket>, std::mutex> writeMutex;
std::unordered_map<std::shared_ptr<TCPSocket>, std::queue<IOCPPASSINDATA*>> writeBuffer;
#endif