X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=demos%2Factors%2Fsimplest-possible.scm;h=1b649dcbef9bd192dee2a9efdea120d2d2e4cf2d;hb=5f12e17b62324e34e5e81a1c2a21a46edc988705;hp=2b7f42dc8714a94b7e7ac433f1ec03636694a024;hpb=4998e7a9fe3b303923d918cd6087633d5302274f;p=8sync.git diff --git a/demos/actors/simplest-possible.scm b/demos/actors/simplest-possible.scm index 2b7f42d..1b649dc 100644 --- a/demos/actors/simplest-possible.scm +++ b/demos/actors/simplest-possible.scm @@ -17,7 +17,8 @@ ;;; License along with 8sync. If not, see . (use-modules (8sync actors) - (oop goops)) + (oop goops) + (fibers conditions)) (define-actor () ((greet-proog @@ -28,12 +29,17 @@ (define-actor () ((greet-emo (lambda (actor message) - (display "proog> Listen, Emo! Listen to the sounds of the machine!\n"))))) + (display "proog> Listen, Emo! Listen to the sounds of the machine!\n") + (signal-condition! (.done? actor))))) + (done? #:init-keyword #:done? + #:accessor .done?)) -(define hive (make-hive)) -(define our-emo (bootstrap-actor hive )) -(define our-proog (bootstrap-actor hive )) (define (main . args) - (run-hive hive - (list (bootstrap-message hive our-emo 'greet-proog - our-proog)))) + (run-hive + (lambda (hive) + (define done? (make-condition)) + (define our-emo (bootstrap-actor hive )) + (define our-proog (bootstrap-actor hive + #:done? done?)) + (<- our-emo 'greet-proog our-proog) + (wait done?))))