summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2017-01-23 18:51:19 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2017-01-23 18:59:15 +0100
commite0e2a99068b47824ec563eb24c2ee617499da491 (patch)
treed2826bc1420492ee569cd773c5270c84b105bfe8 /lib
parentlib: time: clean out thread.c (diff)
downloadfrr-e0e2a99068b47824ec563eb24c2ee617499da491.tar.xz
frr-e0e2a99068b47824ec563eb24c2ee617499da491.zip
lib: cope with negative timeout in thread.c
Since time is no longer cached, if we schedule something with zero timeout, it will automatically be negative by the time we reach the event loop. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/thread.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/thread.c b/lib/thread.c
index 406eddc9e..de7066bb8 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -1203,6 +1203,12 @@ thread_fetch (struct thread_master *m, struct thread *fetch)
timer_wait = timer_wait_bg;
}
+ if (timer_wait && timer_wait->tv_sec < 0)
+ {
+ timerclear(&timer_val);
+ timer_wait = &timer_val;
+ }
+
num = fd_select (m, FD_SETSIZE, &readfd, &writefd, &exceptfd, timer_wait);
/* Signals should get quick treatment */