From: David Lamparter Date: Mon, 23 Jan 2017 17:51:19 +0000 (+0100) Subject: lib: cope with negative timeout in thread.c X-Git-Tag: frr-3.0-branchpoint~64^2~9^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e0e2a99068b47824ec563eb24c2ee617499da491;p=matthieu%2Ffrr.git 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 --- diff --git a/lib/thread.c b/lib/thread.c index 406eddc9e6..de7066bb82 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 */