aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-03-27 09:32:24 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-03-27 09:32:24 -0700
commit8e2fd9ca4d8cdf610dcb9fc89cceeb6e51ad2467 (patch)
tree45e51d15ad3ee79f4edd286cb684e2a875be44d3 /src/core
parent041bf64dddf059b58cd9f28c4354733c066b2af8 (diff)
Avoid spin polling
Diffstat (limited to 'src/core')
-rw-r--r--src/core/lib/iomgr/ev_epoll_linux.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/lib/iomgr/ev_epoll_linux.c b/src/core/lib/iomgr/ev_epoll_linux.c
index e6478c11b0..168980ab39 100644
--- a/src/core/lib/iomgr/ev_epoll_linux.c
+++ b/src/core/lib/iomgr/ev_epoll_linux.c
@@ -1487,8 +1487,9 @@ static int poll_deadline_to_millis_timeout(gpr_timespec deadline,
return 0;
}
timeout = gpr_time_sub(deadline, now);
- return gpr_time_to_millis(gpr_time_add(
- timeout, gpr_time_from_nanos(GPR_NS_PER_MS - 1, GPR_TIMESPAN)));
+ return GPR_MAX(
+ 1, gpr_time_to_millis(gpr_time_add(
+ timeout, gpr_time_from_nanos(GPR_NS_PER_MS - 1, GPR_TIMESPAN))));
}
static void fd_become_readable(grpc_exec_ctx *exec_ctx, grpc_fd *fd,