AtlatestRepositorysigil-wm

sigil-wm / tree / testrepl-concurrency.sgl

1(import (sigil async) (sigil io) (sigil process) (sigil wm repl) (sigil wm dispatch))
2(define owner (make-dispatcher))
3(define environment (interaction-environment))
4(define stopped? #f)
5(define server #f)
6(with-async
7 (set! server
8 (start-repl! #f (getenv "SIGIL_WM_REPL")
9 (lambda (form)
10 (dispatcher-call! owner
11 (lambda () ((eval (list 'lambda '() form) environment)))))))
12 (display "REPL_CONCURRENCY=READY\n") (flush-output-port)
13 (go
14 (let loop ()
15 (dispatcher-wait! owner)
16 (dispatcher-drain! owner)
17 (unless stopped? (loop)))
18 (sleep 0.1)
19 (stop-repl! server)
20 (dispatcher-close! owner)))
21(display "REPL_CONCURRENCY_HOST=PASS\n")