| 
									
										
										
										
											2008-04-02 19:25:33 -04:00
										 |  |  | IN: concurrency.distributed.tests | 
					
						
							|  |  |  | USING: tools.test concurrency.distributed kernel io.files | 
					
						
							| 
									
										
										
										
											2008-12-15 04:33:04 -05:00
										 |  |  | io.files.temp io.directories arrays io.sockets system | 
					
						
							|  |  |  | combinators threads math sequences concurrency.messaging | 
					
						
							|  |  |  | continuations accessors prettyprint ;
 | 
					
						
							| 
									
										
										
										
											2009-05-16 01:29:21 -04:00
										 |  |  | FROM: concurrency.messaging => receive send ;
 | 
					
						
							| 
									
										
										
										
											2008-04-02 19:25:33 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-17 06:21:45 -04:00
										 |  |  | : test-node ( -- addrspec )
 | 
					
						
							| 
									
										
										
										
											2008-04-02 19:25:33 -04:00
										 |  |  |     { | 
					
						
							|  |  |  |         { [ os unix? ] [ "distributed-concurrency-test" temp-file <local> ] } | 
					
						
							|  |  |  |         { [ os windows? ] [ "127.0.0.1" 1238 <inet4> ] } | 
					
						
							|  |  |  |     } cond ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ [ "distributed-concurrency-test" temp-file delete-file ] ignore-errors ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-17 06:21:45 -04:00
										 |  |  | [ ] [ test-node dup (start-node) ] unit-test | 
					
						
							| 
									
										
										
										
											2008-04-02 19:25:33 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							| 
									
										
										
										
											2008-11-30 19:28:15 -05:00
										 |  |  |         receive first2 [ 3 + ] dip send | 
					
						
							| 
									
										
										
										
											2008-04-02 19:25:33 -04:00
										 |  |  |         "thread-a" unregister-process | 
					
						
							|  |  |  |     ] "Thread A" spawn | 
					
						
							|  |  |  |     "thread-a" swap register-process | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 8 ] [ | 
					
						
							|  |  |  |     5 self 2array
 | 
					
						
							|  |  |  |     "thread-a" test-node <remote-process> send | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     receive | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ test-node stop-node ] unit-test |