factor/basis/concurrency/distributed/distributed-tests.factor

27 lines
749 B
Factor
Raw Normal View History

2016-11-10 05:32:08 -05:00
USING: arrays calendar concurrency.distributed
concurrency.messaging io.sockets kernel math namespaces
sequences threads tools.test ;
FROM: concurrency.messaging => receive send ;
IN: concurrency.distributed.tests
2008-04-02 19:25:33 -04:00
CONSTANT: test-ip "127.0.0.1"
2016-11-10 05:32:08 -05:00
CONSTANT: test-port 57234
2016-11-10 05:32:08 -05:00
[ 8 ] [
local-node get
test-ip test-port <inet4> start-node
local-node get swap local-node set-global
local-node [
[
receive first2 [ 3 + ] dip send
"thread-a" unregister-remote-thread
] "Thread A" spawn
"thread-a" register-remote-thread
5 self 2array
2016-11-10 05:32:08 -05:00
test-ip test-port <inet4> "thread-a" <remote-thread> send
100 seconds receive-timeout
2016-11-10 05:32:08 -05:00
stop-node
] with-variable
] unit-test