Merge branch 'master' into dev

This commit is contained in:
Nils O. Selåsdal
2012-11-13 09:45:56 +01:00
2 changed files with 12 additions and 4 deletions
+4 -1
View File
@@ -157,8 +157,11 @@ 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:
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;
assert(rc >= 0); assert(rc >= 0);
if(rc < 0) if(rc < 0)
return errno; return errno;
+8 -3
View File
@@ -133,6 +133,8 @@ static int iomux_select_run(struct IOMux *mux_, struct timeval *timeout)
int rc; int rc;
size_t i; size_t i;
int event_cnt = 0; int event_cnt = 0;
fd_set read_set;
fd_set write_set;
if(mux->deleted_cnt) { if(mux->deleted_cnt) {
iomux_select_rebuild(mux); iomux_select_rebuild(mux);
@@ -142,10 +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;
fd_set read_set = mux->master_read_set; again:
fd_set write_set = mux->master_write_set; 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 rc = select(mux->max_fd + 1, &read_set, &write_set, NULL, timeout); //we can use timeout directly
if(rc == -1 && errno == EINTR)
goto again;
assert(rc >= 0); assert(rc >= 0);
if(rc < 0) if(rc < 0)
return -1; return -1;