Enable specifying no events when registring with the iomux
This commit is contained in:
+1
-11
@@ -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
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user