Replace goto with do while
This commit is contained in:
+5
-3
@@ -157,10 +157,12 @@ static int iomux_epoll_run(struct IOMux *mux_, struct timeval *timeout)
|
|||||||
timeout_ms = timeval_to_ms(timeout);
|
timeout_ms = timeval_to_ms(timeout);
|
||||||
else
|
else
|
||||||
timeout_ms = -1;
|
timeout_ms = -1;
|
||||||
again:
|
|
||||||
|
do {
|
||||||
|
|
||||||
rc = epoll_wait(mux->epoll_fd, mux->pending_events, EPOLL_WAIT_EVENTS, timeout_ms);
|
rc = epoll_wait(mux->epoll_fd, mux->pending_events, EPOLL_WAIT_EVENTS, timeout_ms);
|
||||||
if (rc == -1 && errno == EINTR)
|
|
||||||
goto again;
|
while (rc == -1 && errno == EINTR)
|
||||||
|
|
||||||
assert(rc >= 0);
|
assert(rc >= 0);
|
||||||
if(rc < 0)
|
if(rc < 0)
|
||||||
|
|||||||
+4
-3
@@ -144,12 +144,13 @@ static int iomux_select_run(struct IOMux *mux_, struct timeval *timeout)
|
|||||||
if (mux->max_fd == -1 && timeout == NULL)
|
if (mux->max_fd == -1 && timeout == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
again:
|
do {
|
||||||
|
|
||||||
read_set = mux->master_read_set;
|
read_set = mux->master_read_set;
|
||||||
write_set = mux->master_write_set;
|
write_set = mux->master_write_set;
|
||||||
rc = select(mux->max_fd + 1, &read_set, &write_set, NULL, timeout); //we can use timeout directly
|
rc = select(mux->max_fd + 1, &read_set, &write_set, NULL, timeout); //we can use timeout directly
|
||||||
if (rc == -1 && errno == EINTR)
|
|
||||||
goto again;
|
while (rc == -1 && errno == EINTR)
|
||||||
|
|
||||||
assert(rc >= 0);
|
assert(rc >= 0);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user