stop-actor-system
This commit is contained in:
parent
3fe5d3a343
commit
44bee78044
|
@ -45,6 +45,7 @@
|
||||||
turn-facet!
|
turn-facet!
|
||||||
turn-stop!
|
turn-stop!
|
||||||
turn-spawn!
|
turn-spawn!
|
||||||
|
turn-stop-actor-system!
|
||||||
turn-stop-actor!
|
turn-stop-actor!
|
||||||
turn-crash!
|
turn-crash!
|
||||||
turn-field!
|
turn-field!
|
||||||
|
@ -196,8 +197,8 @@
|
||||||
(thread-wait (engine-thread e)))
|
(thread-wait (engine-thread e)))
|
||||||
|
|
||||||
(define (actor-system-shutdown! e)
|
(define (actor-system-shutdown! e)
|
||||||
(for [(ac (in-list (engine-shutdown! e)))]
|
(define actors (engine-shutdown! e))
|
||||||
(actor-terminate! ac #t)))
|
(for [(ac (in-list actors))] (actor-terminate! ac #t)))
|
||||||
|
|
||||||
(define (escape-pod boot-proc #:name [name 'escape-pod])
|
(define (escape-pod boot-proc #:name [name 'escape-pod])
|
||||||
(define e (actor-engine (facet-actor (turn-active-facet (current-turn)))))
|
(define e (actor-engine (facet-actor (turn-active-facet (current-turn)))))
|
||||||
|
@ -384,6 +385,10 @@
|
||||||
new-facet))
|
new-facet))
|
||||||
|
|
||||||
(define (turn-stop! [f (turn-active-facet (current-turn))] [continuation #f])
|
(define (turn-stop! [f (turn-active-facet (current-turn))] [continuation #f])
|
||||||
|
(when (not (eq? (facet-actor f) (facet-actor (turn-active-facet (current-turn)))))
|
||||||
|
(error 'turn-stop! "Attempted to stop facet ~v from different actor ~v"
|
||||||
|
f
|
||||||
|
(facet-actor (turn-active-facet (current-turn)))))
|
||||||
(log-syndicate/actor-debug " ENQ stop-facet ~v" f)
|
(log-syndicate/actor-debug " ENQ stop-facet ~v" f)
|
||||||
(turn-enqueue! (current-turn)
|
(turn-enqueue! (current-turn)
|
||||||
f
|
f
|
||||||
|
@ -425,6 +430,13 @@
|
||||||
linked-peer link-message handle)
|
linked-peer link-message handle)
|
||||||
(deliver (entity-assert link-entity) link-message handle)))))))
|
(deliver (entity-assert link-entity) link-message handle)))))))
|
||||||
|
|
||||||
|
(define (turn-stop-actor-system! turn)
|
||||||
|
(define ac (facet-actor (turn-active-facet turn)))
|
||||||
|
(log-syndicate/actor-debug " ENQ stop-actor-system ~v" ac)
|
||||||
|
(turn-enqueue! turn (actor-root ac) (lambda ()
|
||||||
|
(log-syndicate/actor-debug " DEQ stop-actor-system ~v" ac)
|
||||||
|
(actor-system-shutdown! (actor-engine ac)))))
|
||||||
|
|
||||||
(define (turn-stop-actor! turn)
|
(define (turn-stop-actor! turn)
|
||||||
(define ac (facet-actor (turn-active-facet turn)))
|
(define ac (facet-actor (turn-active-facet turn)))
|
||||||
(log-syndicate/actor-debug " ENQ stop-actor ~v" ac)
|
(log-syndicate/actor-debug " ENQ stop-actor ~v" ac)
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
react
|
react
|
||||||
let-event
|
let-event
|
||||||
define-field
|
define-field
|
||||||
|
stop-actor-system
|
||||||
stop-facet
|
stop-facet
|
||||||
stop-current-facet
|
stop-current-facet
|
||||||
on-start
|
on-start
|
||||||
|
@ -191,6 +192,9 @@
|
||||||
(define-syntax-rule (define-field id initial-value)
|
(define-syntax-rule (define-field id initial-value)
|
||||||
(define id (turn-field! this-turn 'id initial-value)))
|
(define id (turn-field! this-turn 'id initial-value)))
|
||||||
|
|
||||||
|
(define (stop-actor-system)
|
||||||
|
(turn-stop-actor-system! this-turn))
|
||||||
|
|
||||||
(define-syntax stop-facet
|
(define-syntax stop-facet
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
[(_ f) (turn-stop! f)]
|
[(_ f) (turn-stop! f)]
|
||||||
|
|
Loading…
Reference in New Issue