aboutsummaryrefslogtreecommitdiffstats
path: root/vlib
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-12-07 14:07:54 +0100
committerNeale Ranns <nranns@cisco.com>2016-12-07 14:54:53 +0000
commit18bc907afaff8f8e87af98b8b77b1a61782c85ab (patch)
tree98096fe227a4fb512b612c195e7b25dc5f62f105 /vlib
parentde8867535a32f448c94c983633201fe1f9e835b6 (diff)
epoll_input: don't sleep if we expect event in less than 1 ms
Change-Id: I81652fb04608d805497a600c7dc8041911bbf39a Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vlib')
-rw-r--r--vlib/vlib/unix/input.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/vlib/vlib/unix/input.c b/vlib/vlib/unix/input.c
index b4f2ba537a4..07096ed27dc 100644
--- a/vlib/vlib/unix/input.c
+++ b/vlib/vlib/unix/input.c
@@ -112,11 +112,21 @@ linux_epoll_input (vlib_main_t * vm,
(((i64) t - (i64) clib_cpu_time_now ())
* vm->clib_time.seconds_per_clock)
/* subtract off some slop time */ - 50e-6;
- timeout_ms = timeout * 1e3;
- /* Must be between 1 and 10 ms. */
- timeout_ms = clib_max (1, timeout_ms);
- timeout_ms = clib_min (max_timeout_ms, timeout_ms);
+ if (timeout < 1e3)
+ {
+ /* We have event happenning in less than 1 ms so
+ don't allow epoll to wait */
+ timeout_ms = 0;
+ }
+ else
+ {
+ timeout_ms = timeout * 1e3;
+
+ /* Must be between 1 and 10 ms. */
+ timeout_ms = clib_max (1, timeout_ms);
+ timeout_ms = clib_min (max_timeout_ms, timeout_ms);
+ }
}
/* If we still have input nodes polling (e.g. vnet packet generator)