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:
parent
131557a20f
commit
a959c7f988
|
@ -1895,7 +1895,10 @@
|
||||||
[else
|
[else
|
||||||
;; Inform the scheduler that it's in atomic mode
|
;; Inform the scheduler that it's in atomic mode
|
||||||
(scheduler-start-atomic)
|
(scheduler-start-atomic)
|
||||||
|
;; Now that the schedule is in atomic mode, reenable interrupts (for GC)
|
||||||
|
(enable-interrupts)
|
||||||
(let ([v (thunk)])
|
(let ([v (thunk)])
|
||||||
|
(disable-interrupts)
|
||||||
(scheduler-end-atomic)
|
(scheduler-end-atomic)
|
||||||
v)])]
|
v)])]
|
||||||
[(box? async-apply)
|
[(box? async-apply)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user