Print effective kill actions
This commit is contained in:
parent
07bab897cc
commit
b78ce4bf62
9
os2.rkt
9
os2.rkt
|
@ -390,9 +390,18 @@
|
||||||
[next-process-id (+ new-pid 1)]))
|
[next-process-id (+ new-pid 1)]))
|
||||||
(run-trapk spawned-state spawning-pid k new-pid))
|
(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)
|
(define (do-kill pid-to-kill reason state)
|
||||||
(cond
|
(cond
|
||||||
[(hash-has-key? (vm-processes state) pid-to-kill)
|
[(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)))
|
(define dying-endpoints (process-endpoints (hash-ref (vm-processes state) pid-to-kill)))
|
||||||
(let* ((state (for/fold ([state state]) ([eid (in-set dying-endpoints)])
|
(let* ((state (for/fold ([state state]) ([eid (in-set dying-endpoints)])
|
||||||
(do-unsubscribe pid-to-kill (eid-pre-eid eid) reason state))))
|
(do-unsubscribe pid-to-kill (eid-pre-eid eid) reason state))))
|
||||||
|
|
Loading…
Reference in New Issue