Permalink
Browse files

Run timeouts that will expire in less than one millisecond.

The timeouts for poll and epoll are given in milliseconds,
which caused busy looping in the event loop for timeouts
with less time remaining.
  • Loading branch information...
1 parent 030cc0f commit 4539bc6fae1f932db873ee50e119248a22fa2cfa @rmn64k rmn64k committed Feb 9, 2009
Showing with 1 addition and 1 deletion.
  1. +1 −1 evloop/timer.c
View
2 evloop/timer.c
@@ -106,7 +106,7 @@ evtimers_run(void)
evtimer_gettime(&now);
while (timeheap_size() > 0) {
struct timespec diff = subtime(timeheap_top(), now);
- if (diff.tv_sec < 0) {
+ if (diff.tv_sec < 0 || (diff.tv_sec == 0 && diff.tv_nsec < 1000000)) {
struct timeout *t = timeheap_remove_top();
t->th.i = -1;
t->cb(-1, EV_TIMEOUT, t->arg);

0 comments on commit 4539bc6

Please sign in to comment.