From 9b98dbde344781e93e2bdcfa599428cda2fda41d Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Fri, 30 Jul 2010 15:35:00 -0700 Subject: Better detection of incorrect proxy values when starting the emulator. Change-Id: I344f06fc16e051359669b8fe9b8dcec0ceca377d --- iolooper-select.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'iolooper-select.c') diff --git a/iolooper-select.c b/iolooper-select.c index bf7ae8f..f5aecbd 100644 --- a/iolooper-select.c +++ b/iolooper-select.c @@ -146,17 +146,26 @@ iolooper_wait( IoLooper* iol, int64_t duration ) int count = iolooper_fd_count(iol); int ret; fd_set errs; + struct timeval tm0, *tm = NULL; if (count == 0) return 0; + if (duration < 0) + tm = NULL; + else { + tm = &tm0; + tm->tv_sec = duration / 1000; + tm->tv_usec = (duration - 1000*tm->tv_sec) * 1000; + } + FD_ZERO(&errs); do { iol->reads_result[0] = iol->reads[0]; iol->writes_result[0] = iol->writes[0]; - ret = select( count, iol->reads_result, iol->writes_result, &errs, NULL); + ret = select( count, iol->reads_result, iol->writes_result, &errs, tm); } while (ret < 0 && errno == EINTR); return ret; -- cgit v1.1