Welcome! Log In Create A New Profile


Why does ngx_epoll_del_event use EPOLL_CTL_MOD

Qiying Wang
October 28, 2019 03:26AM

ngx_epoll_del_event is a function to delete an event. Deleting an event
means unregister the file descriptor from epoll therefore it would not be
triggered unless being added again. But EPOLL_CTL_MOD won't remove the
event as far as I know. It seems the event would be triggered in the next
processing loop. So why use EPOLL_CTL_MOD here rather than just

The source code is located in `src/event/modules/ngx_epoll_module.c`

static ngx_int_t
ngx_epoll_del_event(ngx_event_t *ev, ngx_int_t event, ngx_uint_t flags)
// ......

if (e->active) {
ee.events = prev | (uint32_t) flags;
ee.data.ptr = (void *) ((uintptr_t) c | ev->instance);

} else {
ee.events = 0;
ee.data.ptr = NULL;

ngx_log_debug3(NGX_LOG_DEBUG_EVENT, ev->log, 0,
"epoll del event: fd:%d op:%d ev:%08XD",
c->fd, op, ee.events);

if (epoll_ctl(ep, op, c->fd, &ee) == -1) {
ngx_log_error(NGX_LOG_ALERT, ev->log, ngx_errno,
"epoll_ctl(%d, %d) failed", op, c->fd);
return NGX_ERROR;

ev->active = 0;

return NGX_OK;
nginx-devel mailing list
Subject Author Views Posted

Why does ngx_epoll_del_event use EPOLL_CTL_MOD

Qiying Wang 94 October 28, 2019 03:26AM

Re: Why does ngx_epoll_del_event use EPOLL_CTL_MOD

tokers 51 October 28, 2019 03:56AM

Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 85
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready