| 
									
										
										
										
											2009-09-27 16:11:21 -04:00
										 |  |  | USING: alien.c-types alien.syntax io io.encodings.utf16n | 
					
						
							|  |  |  | io.encodings.utf8 io.files kernel namespaces sequences system threads | 
					
						
							|  |  |  | unix.utilities ;
 | 
					
						
							| 
									
										
										
										
											2009-09-23 14:08:06 -04:00
										 |  |  | IN: native-thread-test | 
					
						
							| 
									
										
										
										
											2009-08-25 13:29:28 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, char** argv ) ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | HOOK: native-string-encoding os ( -- encoding )
 | 
					
						
							|  |  |  | M: windows native-string-encoding utf16n ;
 | 
					
						
							|  |  |  | M: unix native-string-encoding utf8 ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : start-vm-in-os-thread ( args -- threadhandle )
 | 
					
						
							|  |  |  |     \ vm get-global prefix  | 
					
						
							|  |  |  |     [ length ] [ native-string-encoding strings>alien ] bi  | 
					
						
							|  |  |  |      start_standalone_factor_in_new_thread ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : start-tetris-in-os-thread ( -- )
 | 
					
						
							|  |  |  |      { "-run=tetris" } start-vm-in-os-thread drop ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : start-testthread-in-os-thread ( -- )
 | 
					
						
							| 
									
										
										
										
											2009-09-23 14:08:06 -04:00
										 |  |  |      { "-run=native-thread-test" } start-vm-in-os-thread drop ;
 | 
					
						
							| 
									
										
										
										
											2009-08-25 13:29:28 -04:00
										 |  |  |   | 
					
						
							|  |  |  | : testthread ( -- )
 | 
					
						
							|  |  |  |      "/tmp/hello" utf8 [ "hello!\n" write ] with-file-appender 5000000 sleep ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-27 16:11:21 -04:00
										 |  |  | MAIN: testthread |