native-thread-test: clean up
parent
5700d94e2b
commit
6367c8ec85
|
@ -1,4 +1,4 @@
|
||||||
! Copyright (C) 2008, 2009 Slava Pestov.
|
! Copyright (C) 2008, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays sequences kernel kernel.private accessors math
|
USING: arrays sequences kernel kernel.private accessors math
|
||||||
alien.accessors byte-arrays io io.encodings io.encodings.utf8
|
alien.accessors byte-arrays io io.encodings io.encodings.utf8
|
||||||
|
@ -37,17 +37,16 @@ M: string string>alien
|
||||||
|
|
||||||
M: tuple string>alien drop underlying>> ;
|
M: tuple string>alien drop underlying>> ;
|
||||||
|
|
||||||
HOOK: alien>native-string os ( alien -- string )
|
HOOK: native-string-encoding os ( -- encoding ) foldable
|
||||||
|
|
||||||
M: windows alien>native-string utf16n alien>string ;
|
M: unix native-string-encoding utf8 ;
|
||||||
|
M: windows native-string-encoding utf16n ;
|
||||||
|
|
||||||
M: unix alien>native-string utf8 alien>string ;
|
: alien>native-string ( alien -- string )
|
||||||
|
native-string-encoding alien>string ; inline
|
||||||
|
|
||||||
HOOK: native-string>alien os ( string -- alien )
|
: native-string>alien ( string -- alien )
|
||||||
|
native-string-encoding string>alien ; inline
|
||||||
M: windows native-string>alien utf16n string>alien ;
|
|
||||||
|
|
||||||
M: unix native-string>alien utf8 string>alien ;
|
|
||||||
|
|
||||||
: dll-path ( dll -- string )
|
: dll-path ( dll -- string )
|
||||||
path>> alien>native-string ;
|
path>> alien>native-string ;
|
||||||
|
|
|
@ -1,26 +1,24 @@
|
||||||
USING: alien.c-types alien.syntax io io.encodings.utf16n
|
! Copyright (C) 2009 Phil Dawes.
|
||||||
io.encodings.utf8 io.files kernel namespaces sequences system threads
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
|
USING: alien.c-types alien.strings alien.syntax io
|
||||||
|
io.encodings.utf8 io.files kernel sequences system threads
|
||||||
unix.utilities ;
|
unix.utilities ;
|
||||||
IN: native-thread-test
|
IN: native-thread-test
|
||||||
|
|
||||||
FUNCTION: void* start_standalone_factor_in_new_thread ( int argc, char** argv ) ;
|
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 )
|
: start-vm-in-os-thread ( args -- threadhandle )
|
||||||
\ vm get-global prefix
|
vm prefix
|
||||||
[ length ] [ native-string-encoding strings>alien ] bi
|
[ length ] [ native-string-encoding strings>alien ] bi
|
||||||
start_standalone_factor_in_new_thread ;
|
start_standalone_factor_in_new_thread ;
|
||||||
|
|
||||||
: start-tetris-in-os-thread ( -- )
|
: start-tetris-in-os-thread ( -- )
|
||||||
{ "-run=tetris" } start-vm-in-os-thread drop ;
|
{ "-run=tetris" } start-vm-in-os-thread drop ;
|
||||||
|
|
||||||
: start-testthread-in-os-thread ( -- )
|
: start-test-thread-in-os-thread ( -- )
|
||||||
{ "-run=native-thread-test" } start-vm-in-os-thread drop ;
|
{ "-run=native-thread-test" } start-vm-in-os-thread drop ;
|
||||||
|
|
||||||
: testthread ( -- )
|
: test-thread ( -- )
|
||||||
"/tmp/hello" utf8 [ "hello!\n" write ] with-file-appender 5000000 sleep ;
|
"/tmp/hello" utf8 [ "hello!\n" write ] with-file-appender 5000000 sleep ;
|
||||||
|
|
||||||
MAIN: testthread
|
MAIN: test-thread
|
||||||
|
|
Loading…
Reference in New Issue