concurrency.distributed-tests: add test for send-/reply-synchronous
							parent
							
								
									a25bffeb01
								
							
						
					
					
						commit
						620ab30ed7
					
				| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
USING: arrays calendar concurrency.distributed
 | 
			
		||||
USING: accessors arrays calendar concurrency.distributed
 | 
			
		||||
concurrency.messaging io.sockets kernel math namespaces
 | 
			
		||||
sequences threads tools.test ;
 | 
			
		||||
FROM: concurrency.messaging => receive send ;
 | 
			
		||||
| 
						 | 
				
			
			@ -6,6 +6,7 @@ IN: concurrency.distributed.tests
 | 
			
		|||
 | 
			
		||||
CONSTANT: test-ip "127.0.0.1"
 | 
			
		||||
CONSTANT: test-port 57234
 | 
			
		||||
CONSTANT: test-port2 57235
 | 
			
		||||
 | 
			
		||||
[ 8 ] [
 | 
			
		||||
    local-node get
 | 
			
		||||
| 
						 | 
				
			
			@ -24,3 +25,16 @@ CONSTANT: test-port 57234
 | 
			
		|||
    ] with-variable
 | 
			
		||||
] unit-test
 | 
			
		||||
 | 
			
		||||
[ 15 ] [
 | 
			
		||||
    local-node get
 | 
			
		||||
    test-ip test-port2 <inet4> start-node
 | 
			
		||||
    local-node get swap local-node set-global
 | 
			
		||||
    local-node [
 | 
			
		||||
        [
 | 
			
		||||
            receive dup data>> 3 * swap reply-synchronous
 | 
			
		||||
            "thread-s" unregister-remote-thread
 | 
			
		||||
        ] "Thread S" spawn "thread-s" register-remote-thread
 | 
			
		||||
        5 test-ip test-port2 <inet4> "thread-s" <remote-thread> send-synchronous
 | 
			
		||||
        stop-node
 | 
			
		||||
    ] with-variable
 | 
			
		||||
] unit-test
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue