1 USING: tools.test concurrency.exchangers
2 concurrency.count-downs concurrency.promises locals kernel
4 FROM: sequences => 3append ;
5 IN: concurrency.exchangers.tests
7 :: exchanger-test ( -- string )
16 v1 ", " v2 3append pr fulfill
17 ] "Awaiter" spawn drop
20 "Goodbye world" ex exchange v1! c count-down
21 ] "Exchanger 1" spawn drop
24 "Hello world" ex exchange v2! c count-down
25 ] "Exchanger 2" spawn drop
29 [ "Hello world, Goodbye world" ] [ exchanger-test ] unit-test