X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=sam.git;a=blobdiff_plain;f=sam.scm;h=fbe800e53436138590f3674c7900b7e86e851e39;hp=c40116dd7258527eab4dcd232c958d89d1c01983;hb=HEAD;hpb=7b73d44a72ed33304da016672c8f243a585856fa diff --git a/sam.scm b/sam.scm index c40116d..fbe800e 100644 --- a/sam.scm +++ b/sam.scm @@ -51,15 +51,20 @@ ;; (See also macros defined in sam-macros.scm.) (define (beh-proc beh) - (car beh)) + (cadr beh)) (define (beh-parent beh) - (cdr beh)) + (caddr beh)) (define root-beh (make-beh : #f (self) (('ping recipient) => (send-message recipient 'pong)))) +(define (beh? x) + (and (pair? x) + (not (null? x)) + (eq? (car x) 'beh))) + ;; Actors (define (make-address host port id) @@ -113,7 +118,7 @@ ('pass (log-trace "Passing to parent behaviour...") (loop (beh-parent beh))) - ((? procedure? new-beh) (hash-table-set! actor-table id new-beh)) + ((? beh? new-beh) (hash-table-set! actor-table id new-beh)) (else 'do-nothing)) ; sleep is now the default (o (exn) @@ -222,6 +227,7 @@ (define-beh system-beh (self) + (('shutdown) => (log-msg "System actor received shutdown message.") (exit 0)