AtlatestRepositoryfolio

folio / tree / testf3a-lock-holder.sgl

1;;; f3a-lock-holder.sgl -- acquire the root's coordination lock and hold it
2;;; until killed. The crash arm (gate-f3a.sh G4) SIGKILLs this process and
3;;; then proves, from a second process, that the kernel released the lock --
4;;; the D11 ownership property, demonstrated rather than narrated.
5(import (sigil core) (sigil io) (sigil fs) (sigil time) (folio doc lock))
6
7(define root (or (getenv "F3A_ROOT")
8 (begin (println "HOLDER ERROR F3A_ROOT not set") (exit 3))))
9(define l (acquire-root-lock root 5))
10(if (root-lock? l)
11 (begin
12 (println "HOLDER_HOLDING pid-helper=~a" (root-lock-helper-pid l))
13 ;; Hold forever; release only arrives as SIGKILL from the gate.
14 (let loop () (sleep 1) (loop)))
15 (begin
16 (println "HOLDER ERROR could not acquire")
17 (exit 2)))