The Lambda Lab
/
projects
/
sam.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Sleep is now the default actor behaviour.
[sam.git]
/
sam.scm
diff --git
a/sam.scm
b/sam.scm
index
a8ea67b
..
c40116d
100644
(file)
--- a/
sam.scm
+++ b/
sam.scm
@@
-58,8
+58,7
@@
(define root-beh
(make-beh : #f (self)
(('ping recipient) =>
(define root-beh
(make-beh : #f (self)
(('ping recipient) =>
- (send-message recipient 'pong)
- 'sleep)))
+ (send-message recipient 'pong))))
;; Actors
;; Actors
@@
-111,13
+110,12
@@
(condition-case
(match (apply (beh-proc beh) (cons address message))
('done (hash-table-delete! actor-table id))
(condition-case
(match (apply (beh-proc beh) (cons address message))
('done (hash-table-delete! actor-table id))
- ('sleep 'do-nothing)
('pass
(log-trace "Passing to parent behaviour...")
(loop (beh-parent beh)))
((? procedure? new-beh) (hash-table-set! actor-table id new-beh))
(else
('pass
(log-trace "Passing to parent behaviour...")
(loop (beh-parent beh)))
((? procedure? new-beh) (hash-table-set! actor-table id new-beh))
(else
- (log-msg "Warning: behaviour of actor " id " returned invalid value.")))
+ 'do-nothing)) ; sleep is now the default
(o (exn)
(log-msg "Warning: actor " id " crashed evaluating message " (->stringrep message))
(print-error-message o)))
(o (exn)
(log-msg "Warning: actor " id " crashed evaluating message " (->stringrep message))
(print-error-message o)))
@@
-230,15
+228,13
@@
'done)
(('print strings ...) =>
'done)
(('print strings ...) =>
- (apply print strings)
- 'sleep)
+ (apply print strings))
(('read reader) =>
(mutex-lock! reader-queue-mutex)
(fifo-push reader-queue reader)
(mutex-unlock! reader-available-mutex)
(('read reader) =>
(mutex-lock! reader-queue-mutex)
(fifo-push reader-queue reader)
(mutex-unlock! reader-available-mutex)
- (mutex-unlock! reader-queue-mutex)
- 'sleep))
+ (mutex-unlock! reader-queue-mutex)))
(define (boot-sam)
(start-console)
(define (boot-sam)
(start-console)