~ chicken-core (chicken-5) 580d44f6c885872fe446ea263385b1fcd75eed5b
commit 580d44f6c885872fe446ea263385b1fcd75eed5b
Author: Peter Bex <peter@more-magic.net>
AuthorDate: Mon Apr 30 20:54:28 2018 +0200
Commit: Kooda <kooda@upyum.com>
CommitDate: Mon Apr 30 21:33:16 2018 +0200
Convert timeout to an exact number of milliseconds before sleeping
This fixes a segfault in the C_ready_fds_timeout code that expected an
unsigned integer. We get a segfault instead of an exception because
scheduler.scm has (declare (unsafe)) at the top.
Fixes #1459
Signed-off-by: Kooda <kooda@upyum.com>
diff --git a/scheduler.scm b/scheduler.scm
index 6cb8cc56..b9710488 100644
--- a/scheduler.scm
+++ b/scheduler.scm
@@ -457,6 +457,7 @@ EOF
(rq? (pair? ready-queue-head))
(tmo (if (and to? (not rq?)) ; no thread was unblocked by timeout, so wait
(let* ((tmo1 (caar ##sys#timeout-list))
+ (tmo1 (inexact->exact (round tmo1)))
(now (##core#inline_allocate ("C_a_i_current_milliseconds" 7) #f)))
(max 0 (- tmo1 now)) )
0))) ; otherwise immediate timeout.
Trap