Enable specifying no events when registring with the iomux

This commit is contained in:
Nils O. Selåsdal
2015-11-10 21:35:16 +01:00
parent 7d9ebd7211
commit 4ce1c24610
2 changed files with 2 additions and 12 deletions
+1 -11
View File
@@ -59,16 +59,6 @@ static int iomux_epoll_update_events(struct IOMux *mux_, struct IOMuxFD *fd)
struct epoll_event e_event = {0, {0}}; struct epoll_event e_event = {0, {0}};
int rc; int rc;
//if we EPOLL_CTL_MOD with events of 0, epoll
//will still wait for HUP/ERR , which can lead to
//strange things. (e.g. updating fd->what to 0 on a pipe
//in order to try to "pause" reading can lead to missing or false
//read events.
assert(fd->what != 0);
if (fd->what == 0)
return EINVAL;
e_event.events = mux_2_epoll_events(fd->what); e_event.events = mux_2_epoll_events(fd->what);
e_event.data.ptr = fd; e_event.data.ptr = fd;
@@ -86,7 +76,7 @@ static int iomux_epoll_register_fd(struct IOMux *mux_, struct IOMuxFD *fd)
struct epoll_event e_event = {0, {0}}; struct epoll_event e_event = {0, {0}};
int rc; int rc;
if (fd->what == 0 || fd->callback == NULL) if (fd->callback == NULL)
return EINVAL; return EINVAL;
e_event.events = mux_2_epoll_events(fd->what); e_event.events = mux_2_epoll_events(fd->what);
+1 -1
View File
@@ -65,7 +65,7 @@ static int iomux_select_register_fd(struct IOMux *mux_, struct IOMuxFD *fd)
struct IOMuxSelect *mux = mux_->instance; struct IOMuxSelect *mux = mux_->instance;
int rc; int rc;
if ((fd->what & MUX_EV_MASK) == 0 || fd->callback == NULL) if (fd->callback == NULL)
return EINVAL; return EINVAL;
rc = iomux_select_update_events(mux_, fd); rc = iomux_select_update_events(mux_, fd);