From ad76d81127797f4b61aa79c123948bc0ebf41256 Mon Sep 17 00:00:00 2001 From: Matt Birkholz Date: Thu, 15 Mar 2018 20:02:11 -0700 Subject: [PATCH] edwin/intmod: Hack Edwin data structures ONLY in editor-thread. --- src/edwin/intmod.scm | 59 +++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/src/edwin/intmod.scm b/src/edwin/intmod.scm index f7ad3947f..eb951db56 100644 --- a/src/edwin/intmod.scm +++ b/src/edwin/intmod.scm @@ -114,32 +114,39 @@ evaluated in the specified inferior REPL buffer." (buffer-put! buffer 'MAJOR-MODE-LOCKED #t)) (if (environment? environment) (local-set-variable! scheme-environment environment buffer)) - (create-thread editor-thread-root-continuation - (lambda () - (let ((port - (make-interface-port buffer - (let ((thread (current-thread))) - (detach-thread thread) - thread)))) - (attach-buffer-interface-port! buffer port) - (parameterize* (list (cons param:%exit-hook inferior-repl/%exit) - (cons param:quit-hook inferior-repl/quit)) - (lambda () - (dynamic-wind - (lambda () unspecific) - (lambda () - (repl/start (make-repl #f - port - environment - #f - `((ERROR-DECISION ,error-decision)) - user-initial-prompt) - (make-init-message message))) - (lambda () - (signal-thread-event editor-thread - (lambda () - (unwind-inferior-repl-buffer buffer))))))))) - buffer)) + (let ((return (make-thread-queue 1)) + (proceed (make-thread-queue 1))) + (create-thread editor-thread-root-continuation + (lambda () + (let ((port + (make-interface-port buffer + (let ((thread (current-thread))) + (detach-thread thread) + thread)))) + (thread-queue/queue! return port) ;pass port to editor-thread + (thread-queue/dequeue! proceed) ;wait for port to be attached + (parameterize* (list (cons param:%exit-hook inferior-repl/%exit) + (cons param:quit-hook inferior-repl/quit)) + (lambda () + (dynamic-wind + (lambda () unspecific) + (lambda () + (repl/start + (make-repl #f + port + environment + #f + `((ERROR-DECISION ,error-decision)) + user-initial-prompt) + (make-init-message message))) + (lambda () + (signal-thread-event editor-thread + (lambda () + (unwind-inferior-repl-buffer buffer))))))))) + buffer) + (let ((port (thread-queue/dequeue! return))) + (attach-buffer-interface-port! buffer port) + (thread-queue/queue! proceed 'ready)))) (define (make-init-message message) (if message -- 2.25.1