Timeout is an absolute time, not an interval.

Fixes the wrong assumption, passing all tests at that point.
This commit is contained in:
llmII 2021-09-04 08:02:50 -05:00
parent 1736c9b0f8
commit b559f9625a
No known key found for this signature in database
GPG Key ID: E3AD2E259F58A9A0
1 changed files with 5 additions and 1 deletions

View File

@ -1679,7 +1679,11 @@ void janet_loop1_impl(int has_timeout, JanetTimestamp timeout) {
struct kevent timer;
if (janet_vm.timer_enabled || has_timeout) {
EV_SET(&timer, JANET_KQUEUE_TIMER_IDENT, EVFILT_TIMER, EV_ADD | EV_ENABLE | EV_CLEAR, NOTE_MSECONDS, timeout, &janet_vm.timer);
EV_SET(&timer,
JANET_KQUEUE_TIMER_IDENT,
EVFILT_TIMER,
EV_ADD | EV_ENABLE | EV_CLEAR,
NOTE_MSECONDS | NOTE_ABSTIME, timeout, &janet_vm.timer);
add_kqueue_events(&timer, 1);
}
janet_vm.timer_enabled = has_timeout;