diff --git a/src/iomux_epoll.c b/src/iomux_epoll.c index 6e22319..a0295c5 100644 --- a/src/iomux_epoll.c +++ b/src/iomux_epoll.c @@ -157,10 +157,12 @@ static int iomux_epoll_run(struct IOMux *mux_, struct timeval *timeout) timeout_ms = timeval_to_ms(timeout); else timeout_ms = -1; -again: - rc = epoll_wait(mux->epoll_fd, mux->pending_events, EPOLL_WAIT_EVENTS, timeout_ms); - if (rc == -1 && errno == EINTR) - goto again; + + do { + + rc = epoll_wait(mux->epoll_fd, mux->pending_events, EPOLL_WAIT_EVENTS, timeout_ms); + + while (rc == -1 && errno == EINTR) assert(rc >= 0); if(rc < 0) diff --git a/src/iomux_select.c b/src/iomux_select.c index bcc3fa3..925a1c6 100644 --- a/src/iomux_select.c +++ b/src/iomux_select.c @@ -144,12 +144,13 @@ static int iomux_select_run(struct IOMux *mux_, struct timeval *timeout) if (mux->max_fd == -1 && timeout == NULL) return 0; -again: - read_set = mux->master_read_set; - write_set = mux->master_write_set; - rc = select(mux->max_fd + 1, &read_set, &write_set, NULL, timeout); //we can use timeout directly - if (rc == -1 && errno == EINTR) - goto again; + do { + + read_set = mux->master_read_set; + write_set = mux->master_write_set; + rc = select(mux->max_fd + 1, &read_set, &write_set, NULL, timeout); //we can use timeout directly + + while (rc == -1 && errno == EINTR) assert(rc >= 0); if (rc < 0)