Add ground spy to example

This commit is contained in:
Tony Garnock-Jones 2012-03-24 16:12:42 -04:00
parent 19da898244
commit a7b4dec151
1 changed files with 12 additions and 0 deletions

View File

@ -23,8 +23,20 @@
(newline)
(transition 'no-state (kill)))))
(define spy
(lambda ()
(define (hs label)
(define ((w kind) . args) (write `(,label ,kind ,@args)) (newline) values)
(handlers (w 'presence)
(w 'absence)
(w 'message)))
(transition 'spy-state
(add-role (topic-publisher (wild) #:virtual? #t) (hs 'subscriber->publisher))
(add-role (topic-subscriber (wild) #:virtual? #t) (hs 'publisher->subscriber)))))
(ground-vm (lambda ()
(transition 'no-state
(spawn spy)
(spawn (lambda () (example-process 1000)))
(spawn (lambda () (example-process 2000)))
(kill))))