[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread and guile environment

From: Andy Wingo
Subject: Re: Thread and guile environment
Date: Sat, 10 Jul 2010 10:22:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)


On Fri 09 Jul 2010 22:23, Neil Jerram <address@hidden> writes:

> Andy Wingo <address@hidden> 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 <address@hidden>
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 ();
-  scm_init_threads_default_dynamic_state ();
   scm_initialized_p = 1;
@@ -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 ();


reply via email to

[Prev in Thread] Current Thread [Next in Thread]