Add ground spy to example
This commit is contained in:
parent
19da898244
commit
a7b4dec151
|
@ -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))))
|
||||
|
|
Loading…
Reference in New Issue