Skip to content

Commit

Permalink
let's try adjusting the timeout even if none has been passed as argument
Browse files Browse the repository at this point in the history
and existing timer might enforce using a timeout even if none was passed
  • Loading branch information
xant committed Feb 7, 2014
1 parent 751717f commit 3a36e3c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/iomux.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,14 +818,13 @@ iomux_run(iomux_t *iomux, struct timeval *tv_default)
// copy to select()
struct timeval tv_select = { 0, 0 };

if (tv_default) {
// shrink the timeout if we have timers expiring earlier
struct timeval *tv = iomux_adjust_timeout(iomux, tv_default);
// shrink the timeout if we have timers expiring earlier
struct timeval *tv = iomux_adjust_timeout(iomux, tv_default);
if (tv)
memcpy(&tv_select, tv, sizeof(tv_select));
}

MUTEX_UNLOCK(iomux);
int rc = select(maxfd+1, &rin, &rout, NULL, tv_default ? &tv_select : NULL);
int rc = select(maxfd+1, &rin, &rout, NULL, tv ? &tv_select : NULL);
MUTEX_LOCK(iomux);
switch (rc) {
case -1:
Expand Down

0 comments on commit 3a36e3c

Please sign in to comment.