Hi, On Fri 09 Jul 2010 22:23, Neil Jerram <[email protected]> writes:
> Andy Wingo <[email protected]> writes: > >> Interestingly, the first thread has you in (guile-user), but the second >> has you in (guile). So you don't see the full definition of format, nor >> do you see hug. > > That's what I thought too. But in that case I have no idea why my > '(define-module (guile-user))' suggestion didn't work. I think bug.scm was loaded in the main module -- the threads just tried to call a function defined by bug.scm, and as they were in (guile), not (guile-user), there was the error. >> But it's quite ugly. Does anyone have any input as to what module should >> be current when a thread previously unknown to Guile enters Guile? > > Surely it has to be (guile-user), since that what the end of boot-9.scm > moves into - and hence is well-established for the single thread case. Agreed. I just pushed the following patch, which fixes Cedric's case. commit a85f90f5ac5c3c5f830e295c0ca7b006141b1a83 Author: Andy Wingo <[email protected]> Date: Sat Jul 10 10:21:22 2010 +0200 capture default dynamic state in (guile-user) * libguile/init.c (scm_i_init_guile): Move the call to scm_init_threads_default_dynamic_state after the call to scm_load_startup_files, so that the default dynamic state is in the (guile-user) module, not (guile). diff --git a/libguile/init.c b/libguile/init.c index 6313b65..4843910 100644 --- a/libguile/init.c +++ b/libguile/init.c @@ -570,8 +570,6 @@ scm_i_init_guile (SCM_STACKITEM *base) scm_i_init_deprecated (); #endif - scm_init_threads_default_dynamic_state (); - scm_initialized_p = 1; #ifdef STACK_CHECKING @@ -585,6 +583,10 @@ scm_i_init_guile (SCM_STACKITEM *base) atexit (cleanup_for_exit); scm_load_startup_files (); scm_init_load_should_autocompile (); + + /* Capture the dynamic state after loading boot-9, so that new threads end up + in the guile-user module. */ + scm_init_threads_default_dynamic_state (); } /* Andy -- http://wingolog.org/
