22 lines
636 B
Scheme
22 lines
636 B
Scheme
|
(define (test-it)
|
||
|
(let* ((ls (list "a" "b" "c" "d" "e" "f"))
|
||
|
(m-ch (make-mcast-channel))
|
||
|
(a-port (mcast-port m-ch))
|
||
|
(b-port (mcast-port m-ch))
|
||
|
(c-port (mcast-port m-ch))
|
||
|
(d-port (mcast-port m-ch))
|
||
|
(e-port (mcast-port m-ch))
|
||
|
(f-port (mcast-port m-ch))
|
||
|
(mcast-ports (list a-port b-port c-port d-port e-port f-port)))
|
||
|
(for-each (lambda (msg)
|
||
|
(spawn (lambda ()
|
||
|
(mcast m-ch msg))))
|
||
|
ls)
|
||
|
(for-each (lambda (mc-port)
|
||
|
(spawn (lambda ()
|
||
|
(let rcv-msg ((msg (mcast-port-receive mc-port)))
|
||
|
(display msg)
|
||
|
(newline)
|
||
|
(rcv-msg (mcast-port-receive mc-port))))))
|
||
|
mcast-ports)))
|