X-Git-Url: https://jxself.org/git/?p=8sync.git;a=blobdiff_plain;f=demos%2Factors%2Fsimplest-possible.scm;h=1b649dcbef9bd192dee2a9efdea120d2d2e4cf2d;hp=2b7f42dc8714a94b7e7ac433f1ec03636694a024;hb=57b7dfc7a351017e09bd158889ed45fa57e51289;hpb=8cbb7f22227c0afdd3b0bd758ebec0efba2fa1e1 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?))))