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.
This commit is contained in:
Matthew Flatt 2020-12-14 06:54:54 -07:00
parent 131557a20f
commit a959c7f988

View File

@ -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)