我无法epollctl()管道-我得到了错误的地址



我正在尝试编写一个函数,该函数将使我破坏epoll_wait((。

我有

void SocketSystem::epollBreakWait(int epoll)
{
if (epoll == ERROR_CODE)
return;
int selfpipe[PIPE_PAIR];
if (pipe(selfpipe) < 0)
std::cout << "Error on self pipe." << std::endl;
if (::epoll_ctl(epoll, EPOLL_CTL_ADD, selfpipe[0], NULL) == ERROR_CODE)
std::cout <<  "Error breaking epoll." << std::endl;
int temp = 0;
::write(selfpipe[1], &temp, sizeof(temp));   
}

但当我运行它时,我会得到错误(-1(和errno=错误地址。有什么想法吗?

如何调用epoll_wait本身?我想你必须向epoll_ctl提供非空的struct epoll_event

拼写?

正如您所建议的,我尝试在epoll_ctl中放入一个非null的epoll_event,这似乎解决了问题。

最新更新