Skip to content

Commit

Permalink
faster way of determining if the mux is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Guzzo committed May 22, 2014
1 parent 93e3661 commit f12cca8
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/iomux.c
Original file line number Diff line number Diff line change
Expand Up @@ -860,16 +860,10 @@ iomux_close(iomux_t *iomux, int fd)
int
iomux_isempty(iomux_t *iomux)
{
int fd;
MUTEX_LOCK(iomux);
for (fd = iomux->minfd; fd <= iomux->maxfd; fd++) {
if (iomux->connections[fd]) {
MUTEX_UNLOCK(iomux);
return 0;
}
}
int empty = (TAILQ_FIRST(&iomux->connections_list) == NULL);
MUTEX_UNLOCK(iomux);
return 1;
return empty;
}

int iomux_write_buffer(iomux_t *iomux, int fd)
Expand Down

0 comments on commit f12cca8

Please sign in to comment.