Simplify and rename %%boot to actor-body->spawn-action
This commit is contained in:
parent
97dceedff2
commit
edaf97ae05
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
;; forall
|
;; forall
|
||||||
|
|
||||||
%%boot
|
actor-body->spawn-action
|
||||||
|
|
||||||
;;----------------------------------------
|
;;----------------------------------------
|
||||||
(struct-out actor-state)
|
(struct-out actor-state)
|
||||||
|
@ -330,9 +330,9 @@
|
||||||
(script-complete-instruction new-variables)))))
|
(script-complete-instruction new-variables)))))
|
||||||
(void))))
|
(void))))
|
||||||
|
|
||||||
(define (%%boot thunk)
|
(define (actor-body->spawn-action thunk)
|
||||||
(match ((reply-to (lambda (dummy)
|
(match ((reply-to (lambda (dummy)
|
||||||
(thunk)
|
(actor (thunk))
|
||||||
(error '%%boot "Reached end of boot thunk")))
|
(error '%%boot "Reached end of boot thunk")))
|
||||||
(void))
|
(void))
|
||||||
[(spawn-instruction 'actor action-fn _get-next-instr)
|
[(spawn-instruction 'actor action-fn _get-next-instr)
|
||||||
|
|
|
@ -6,10 +6,8 @@
|
||||||
(struct set-box (new-value) #:transparent)
|
(struct set-box (new-value) #:transparent)
|
||||||
(struct box-state (value) #:transparent)
|
(struct box-state (value) #:transparent)
|
||||||
|
|
||||||
(%%boot
|
(actor-body->spawn-action
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(actor
|
|
||||||
|
|
||||||
(actor (forever #:collect [(current-value 0)]
|
(actor (forever #:collect [(current-value 0)]
|
||||||
(assert (box-state current-value))
|
(assert (box-state current-value))
|
||||||
(on (message (set-box $new-value))
|
(on (message (set-box $new-value))
|
||||||
|
@ -19,4 +17,4 @@
|
||||||
(actor (forever (on (asserted (box-state $v))
|
(actor (forever (on (asserted (box-state $v))
|
||||||
(log-info "client: learned that box's value is now ~v" v)
|
(log-info "client: learned that box's value is now ~v" v)
|
||||||
(send! (set-box (+ v 1))))))
|
(send! (set-box (+ v 1))))))
|
||||||
)))
|
))
|
||||||
|
|
|
@ -34,16 +34,11 @@
|
||||||
(send! (shutdown))
|
(send! (shutdown))
|
||||||
(send! (says user input-string)))))))
|
(send! (says user input-string)))))))
|
||||||
|
|
||||||
(%%boot
|
(actor-body->spawn-action
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(actor
|
|
||||||
|
|
||||||
(perform-core-action! (spawn-tcp-driver))
|
(perform-core-action! (spawn-tcp-driver))
|
||||||
|
|
||||||
(network (define us (tcp-listener 5000))
|
(network (define us (tcp-listener 5000))
|
||||||
(until (message (shutdown))
|
(until (message (shutdown))
|
||||||
(assert (advertise (observe (tcp-channel _ us _))) #:meta-level 1)
|
(assert (advertise (observe (tcp-channel _ us _))) #:meta-level 1)
|
||||||
(on (asserted (advertise (tcp-channel $them us _)) #:meta-level 1)
|
(on (asserted (advertise (tcp-channel $them us _)) #:meta-level 1)
|
||||||
(spawn-session them us))))
|
(spawn-session them us))))))
|
||||||
|
|
||||||
)))
|
|
||||||
|
|
|
@ -10,9 +10,8 @@
|
||||||
(struct save (file) #:prefab)
|
(struct save (file) #:prefab)
|
||||||
(struct delete (name) #:prefab)
|
(struct delete (name) #:prefab)
|
||||||
|
|
||||||
(%%boot
|
(actor-body->spawn-action
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(actor
|
|
||||||
|
|
||||||
(perform-core-action! (spawn-timer-driver))
|
(perform-core-action! (spawn-timer-driver))
|
||||||
|
|
||||||
|
@ -71,4 +70,4 @@
|
||||||
(sleep 0.1)
|
(sleep 0.1)
|
||||||
(print-prompt)))))
|
(print-prompt)))))
|
||||||
|
|
||||||
)))
|
))
|
||||||
|
|
Loading…
Reference in New Issue