Print effective kill actions

This commit is contained in:
Tony Garnock-Jones 2012-05-02 13:53:52 -04:00
parent 07bab897cc
commit b78ce4bf62
1 changed files with 9 additions and 0 deletions

View File

@ -390,9 +390,18 @@
[next-process-id (+ new-pid 1)]))
(run-trapk spawned-state spawning-pid k new-pid))
(define (print-kill pid-to-kill reason)
(cond
[(eq? reason #f) (printf "PID ~v exited normally~n" pid-to-kill)]
[(exn? reason) ((error-display-handler)
(format "PID ~v exited with exception~n~a" pid-to-kill (exn-message reason))
reason)]
[else (printf "PID ~v exited with reason: ~a~n" pid-to-kill reason)]))
(define (do-kill pid-to-kill reason state)
(cond
[(hash-has-key? (vm-processes state) pid-to-kill)
(print-kill pid-to-kill reason)
(define dying-endpoints (process-endpoints (hash-ref (vm-processes state) pid-to-kill)))
(let* ((state (for/fold ([state state]) ([eid (in-set dying-endpoints)])
(do-unsubscribe pid-to-kill (eid-pre-eid eid) reason state))))