From b1cbe0f9a8f57501562e28f0fac9604f5c474315 Mon Sep 17 00:00:00 2001 From: Peter Bex Date: Mon, 30 Apr 2018 20:54:28 +0200 Subject: [PATCH] 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 --- scheduler.scm | 1 + 1 file changed, 1 insertion(+) 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. -- 2.11.0