From 76aefcb508c918347140be71187cfa5cc6d71460 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 17 Jul 2014 07:21:17 +0100 Subject: [PATCH] fix sleep timeout in scheduler In the case that the current time equals exactly the timeout of a `sync/timeout`, the Racket process could get stuck (using no CPU) instead of continuing as it should. How did we not find this before? Why am I suddenly able to replicate the problem (i.e., hitting exactly the target timeout in the secheduler at the millisecond granularity)? Merge to v6.1 --- racket/src/racket/src/thread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/racket/src/racket/src/thread.c b/racket/src/racket/src/thread.c index 120962ed3a..2b1d3ba5e1 100644 --- a/racket/src/racket/src/thread.c +++ b/racket/src/racket/src/thread.c @@ -5186,7 +5186,7 @@ int scheme_block_until(Scheme_Ready_Fun _f, Scheme_Needs_Wakeup_Fun fdf, if (sleep_end) { delay = (float)(sleep_end - scheme_get_inexact_milliseconds()); delay /= 1000.0; - if (delay < 0) + if (delay <= 0) delay = (float)0.00001; } else delay = 0.0;