(define thd-a (thread (lambda ()
(let loop ((m (thread-receive)))
(cond
((equal? m 'hello!)
(thread-send thd-b 'nihao!))
((equal? m 'bye-bye!)
(kill-thread thd-a))
(else
(loop (thread-receive))))))))
(define thd-b (thread (lambda ()
(let loop ((n(thread-receive)))
(cond
((equal? n 'nihao!)
(thread-send thd-a 'hello!))
((equal? n 'bye-bye)
(kill-thread thd-b))
(else
(loop (thread-receive))))))))
2010年5月29日星期六
订阅:
博文评论 (Atom)
没有评论:
发表评论