是否需要在关闭套接字时仅触发 EPOLLONESHOT 事件后手动 EPOLL_CTL_DEL 事件?

问题描述 投票:0回答:0
struct epoll_event ev, events[20];
ev.events = EPOLLOUT | EPOLLONESHOT;
ev.data.sock = some_socket;
epoll_ctl(epfd, EPOLL_CTL_ADD, some_socket, &ev);
// then the EPOLLOUT event has triggered by epoll_wait
epoll_ctl(epfd, EPOLL_CTL_DEL, some_socket, NULL); // should it be called? will it cause error?

EPOLLOUT 事件被触发后,MAN 页面说该事件现在已被禁用,不会被触发。不知道是不是和EPOLL_CTL_DEL完全一样。 如果 EPOLLOUT | 关闭套接字时是否需要手动调用 EPOLL_CTL_DEL EPOLLONESHOT 是唯一被触发的事件吗?

c epoll
© www.soinside.com 2019 - 2024. All rights reserved.