Fix for native I/O backends that create callbacks in deployed apps; this affected tools.deploy.test[35] ever since run-loop multiplexer landed on OS X

db4
Slava Pestov 2008-12-12 19:48:17 -06:00
parent f5395a9c1e
commit a91dee7810
3 changed files with 10 additions and 8 deletions

View File

@ -61,12 +61,6 @@ TUPLE: alien-callback-params < alien-node-params quot xt ;
! Quotation which coerces return value to required type ! Quotation which coerces return value to required type
return-prep-quot infer-quot-here ; return-prep-quot infer-quot-here ;
! Callbacks are registered in a global hashtable. If you clear
! this hashtable, they will all be blown away by code GC, beware
SYMBOL: callbacks
[ H{ } clone callbacks set-global ] "alien.compiler" add-init-hook
: register-callback ( word -- ) callbacks get conjoin ; : register-callback ( word -- ) callbacks get conjoin ;
: callback-bottom ( params -- ) : callback-bottom ( params -- )

View File

@ -1,7 +1,7 @@
! Copyright (C) 2004, 2008 Slava Pestov. ! Copyright (C) 2004, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs kernel math namespaces sequences system USING: accessors assocs kernel math namespaces sequences system
kernel.private byte-arrays arrays ; kernel.private byte-arrays arrays init ;
IN: alien IN: alien
! Some predicate classes used by the compiler for optimization ! Some predicate classes used by the compiler for optimization
@ -72,3 +72,9 @@ ERROR: alien-invoke-error library symbol ;
: alien-invoke ( ... return library function parameters -- ... ) : alien-invoke ( ... return library function parameters -- ... )
2over alien-invoke-error ; 2over alien-invoke-error ;
! Callbacks are registered in a global hashtable. If you clear
! this hashtable, they will all be blown away by code GC, beware.
SYMBOL: callbacks
[ H{ } clone callbacks set-global ] "alien" add-init-hook

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007, 2008 Slava Pestov. ! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: init kernel system namespaces io io.encodings USING: init kernel system namespaces io io.encodings
io.encodings.utf8 init assocs splitting ; io.encodings.utf8 init assocs splitting alien ;
IN: io.backend IN: io.backend
SYMBOL: io-backend SYMBOL: io-backend
@ -32,5 +32,7 @@ M: object normalize-directory normalize-path ;
io-backend set-global init-io init-stdio io-backend set-global init-io init-stdio
"io.files" init-hooks get at call ; "io.files" init-hooks get at call ;
! Note that we have 'alien' in our using list so that the alien
! init hook runs before this one.
[ init-io embedded? [ init-stdio ] unless ] [ init-io embedded? [ init-stdio ] unless ]
"io.backend" add-init-hook "io.backend" add-init-hook