diff options
| author | Richard Nyberg <rnyberg@murmeldjur.se> | 2009-02-09 16:46:04 +0100 |
|---|---|---|
| committer | Richard Nyberg <rnyberg@murmeldjur.se> | 2009-02-09 16:46:04 +0100 |
| commit | 4539bc6fae1f932db873ee50e119248a22fa2cfa (patch) | |
| tree | f96984f11742ce3f72155ba5b5df6a6b071da700 /evloop/timer.c | |
| parent | 030cc0fb9a7a76e48be2ac1bc6752a5112bdaa71 (diff) | |
| download | btpd-4539bc6fae1f932db873ee50e119248a22fa2cfa.tar.gz btpd-4539bc6fae1f932db873ee50e119248a22fa2cfa.zip | |
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.
Diffstat (limited to 'evloop/timer.c')
| -rw-r--r-- | evloop/timer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/evloop/timer.c b/evloop/timer.c index 13fb5e8..c14eaab 100644 --- a/evloop/timer.c +++ b/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); |