mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-20 09:49:15 +03:00
LibCore: CEventLoop: If timeval_sub makes tv_sec negative, use 0
This commit is contained in:
parent
0c4c5b5eb7
commit
dac07a5d76
Notes:
sideshowbarker
2024-07-19 09:36:45 +09:00
Author: https://github.com/jcs Commit: https://github.com/SerenityOS/serenity/commit/dac07a5d762 Pull-request: https://github.com/SerenityOS/serenity/pull/1177
@ -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…
Reference in New Issue
Block a user