From 4a36d8414fa63f0e07b1a39d43dc51df7e94b26d Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Tue, 10 Mar 2015 17:08:10 -0700 Subject: [PATCH] smp: without-interrupts: x11graph.scm --- README.txt | 5 +++++ src/runtime/runtime.pkg | 3 +++ src/runtime/x11graph.scm | 18 ++++++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/README.txt b/README.txt index a58845be0..0777f49a8 100644 --- a/README.txt +++ b/README.txt @@ -1629,5 +1629,10 @@ The hits with accompanying analysis: Punted until Win32 can SMP. x11graph.scm:264: (without-interrupts + Caller: x-graphics/close-display x11graph.scm:344: (without-interrupts + Caller: process-event x11graph.scm:449: (without-interrupts + Caller: x-graphics/close-window + + Used the display-finalizer's mutex to serialize the callers. diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index f014bc266..cfb2169b5 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -3943,6 +3943,9 @@ USA. ((unix) "x11graph") (else)) (parent (runtime)) + (import (runtime gc-finalizer) + with-gc-finalizer-locked + remove-from-locked-gc-finalizer!) (export () create-x-colormap create-x-image diff --git a/src/runtime/x11graph.scm b/src/runtime/x11graph.scm index be741ce99..3b87d3917 100644 --- a/src/runtime/x11graph.scm +++ b/src/runtime/x11graph.scm @@ -261,12 +261,14 @@ USA. display))))) (define (x-graphics/close-display display) - (without-interrupts - (lambda () - (if (x-display/xd display) - (begin - (remove-all-from-gc-finalizer! (x-display/window-finalizer display)) - (remove-from-gc-finalizer! display-finalizer display)))))) + (with-gc-finalizer-locked display-finalizer + (lambda () + (if (x-display/xd display) + (without-interruption + (lambda () + (remove-all-from-gc-finalizer! (x-display/window-finalizer + display)) + (remove-from-locked-gc-finalizer! display-finalizer display))))))) (define (x-graphics/open-display? display) (if (x-display/xd display) #t #f)) @@ -341,7 +343,7 @@ USA. (with-thread-events-blocked loop))) (define (process-event display event) - (without-interrupts + (with-gc-finalizer-locked display-finalizer (lambda () (let ((window (search-gc-finalizer (x-display/window-finalizer display) @@ -446,7 +448,7 @@ USA. (if (x-graphics-device/xw device) #t #f)) (define (x-graphics/close-window device) - (without-interrupts + (with-gc-finalizer-locked display-finalizer (lambda () (close-x-window (graphics-device/descriptor device))))) -- 2.25.1