From a91dee7810a6eeb3003ced2c89e777c37bc7e64b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 12 Dec 2008 19:48:17 -0600 Subject: [PATCH] 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 --- basis/stack-checker/alien/alien.factor | 6 ------ core/alien/alien.factor | 8 +++++++- core/io/backend/backend.factor | 4 +++- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/basis/stack-checker/alien/alien.factor b/basis/stack-checker/alien/alien.factor index a38e9ea784..f52632040d 100644 --- a/basis/stack-checker/alien/alien.factor +++ b/basis/stack-checker/alien/alien.factor @@ -61,12 +61,6 @@ TUPLE: alien-callback-params < alien-node-params quot xt ; ! Quotation which coerces return value to required type 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 ; : callback-bottom ( params -- ) diff --git a/core/alien/alien.factor b/core/alien/alien.factor index 6a5dfe30df..c97e36e889 100644 --- a/core/alien/alien.factor +++ b/core/alien/alien.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors assocs kernel math namespaces sequences system -kernel.private byte-arrays arrays ; +kernel.private byte-arrays arrays init ; IN: alien ! 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 -- ... ) 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 diff --git a/core/io/backend/backend.factor b/core/io/backend/backend.factor index 5456f2251c..e2c6c3d464 100644 --- a/core/io/backend/backend.factor +++ b/core/io/backend/backend.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: init kernel system namespaces io io.encodings -io.encodings.utf8 init assocs splitting ; +io.encodings.utf8 init assocs splitting alien ; IN: io.backend SYMBOL: io-backend @@ -32,5 +32,7 @@ M: object normalize-directory normalize-path ; io-backend set-global init-io init-stdio "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 ] "io.backend" add-init-hook