;;;; A program that stops on its own while an evaluation is in flight. ;;;; ;;;; Setting [go] from the editor starts it: the loop sees it, sleeps without ;;;; polling for longer than a module takes to build, and then signals. An ;;;; expression evaluated just after [go] is therefore waiting in the ring ;;;; when the program's own break is entered, and runs inside that break's ;;;; loop. The stop is the program's and the value is the expression's. (import agent "vendor:agent") (declare-c usleep [us i32] i32 "usleep") (defstruct Late []) (defonce go i64) (defn main [] i32 (while (= go 0) (agent/wait 5)) (usleep 1500000) (restart-case (do (error (Late {})) 0) (carry-on [] 0)))