mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 14:05:08 +00:00
LibCore: CEventLoop: If timeval_sub makes tv_sec negative, use 0
This commit is contained in:
parent
0c4c5b5eb7
commit
dac07a5d76
1 changed files with 4 additions and 0 deletions
|
@ -371,6 +371,10 @@ void EventLoop::wait_for_event(WaitMode mode)
|
|||
gettimeofday(&now, nullptr);
|
||||
get_next_timer_expiration(timeout);
|
||||
timeval_sub(timeout, now, timeout);
|
||||
if (timeout.tv_sec < 0) {
|
||||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 0;
|
||||
}
|
||||
} else {
|
||||
should_wait_forever = true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue