Fix check for expired events.
This would trigger a infinite loop if a timeout expired and the next timeout was not expired yet, but less than 1 second from being expired.
This commit is contained in:
parent
8825cddd0d
commit
d9c70767aa
1 changed files with 1 additions and 1 deletions
|
|
@ -182,7 +182,7 @@ bool event_loop(void) {
|
||||||
timeout_t *timeout = timeout_tree.head->data;
|
timeout_t *timeout = timeout_tree.head->data;
|
||||||
timersub(&timeout->tv, &now, &diff);
|
timersub(&timeout->tv, &now, &diff);
|
||||||
|
|
||||||
if(diff.tv_sec <= 0) {
|
if(diff.tv_sec < 0) {
|
||||||
timeout->cb(timeout->data);
|
timeout->cb(timeout->data);
|
||||||
if(timercmp(&timeout->tv, &now, <))
|
if(timercmp(&timeout->tv, &now, <))
|
||||||
timeout_del(timeout);
|
timeout_del(timeout);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue