From a959c7f98857e2e651148f2acb43a7f7f6547cdf Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Mon, 14 Dec 2020 06:54:54 -0700 Subject: [PATCH] cs: enable GC during atomic callbacks Callbacks from C generally need to be in atomic mode, but they don't need to have interrupts disabled at the Chez Scheme level, because that disables GC. Without this change, dragging a scrollbar or resizing the window in DrRacket would suspend GCs as long as the mouse button is pressed --- which could allocate arbitrary amounts of memory fairly quickly meanwhile. --- racket/src/cs/rumble/foreign.ss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/racket/src/cs/rumble/foreign.ss b/racket/src/cs/rumble/foreign.ss index 8d6911bec7..e435e69915 100644 --- a/racket/src/cs/rumble/foreign.ss +++ b/racket/src/cs/rumble/foreign.ss @@ -1895,7 +1895,10 @@ [else ;; Inform the scheduler that it's in atomic mode (scheduler-start-atomic) + ;; Now that the schedule is in atomic mode, reenable interrupts (for GC) + (enable-interrupts) (let ([v (thunk)]) + (disable-interrupts) (scheduler-end-atomic) v)])] [(box? async-apply)