unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-user@gnu.org
Subject: Re: Thread and guile environment
Date: Sat, 10 Jul 2010 10:22:31 +0200	[thread overview]
Message-ID: <m3ocefoiew.fsf@unquote.localdomain> (raw)
In-Reply-To: <87630oe74w.fsf@ossau.uklinux.net> (Neil Jerram's message of "Fri, 09 Jul 2010 21:23:59 +0100")

Hi,

On Fri 09 Jul 2010 22:23, Neil Jerram <neil@ossau.uklinux.net> writes:

> Andy Wingo <wingo@pobox.com> 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 <wingo@pobox.com>
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/



  reply	other threads:[~2010-07-10  8:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-05  8:23 Thread and guile environment rixed
2010-07-05 19:52 ` Neil Jerram
2010-07-06 11:22   ` Cedric Cellier
2010-07-07 11:02     ` Cedric Cellier
2010-07-08 19:48 ` Andy Wingo
2010-07-09 15:54   ` Cedric Cellier
2010-07-09 19:10     ` Andy Wingo
2010-07-09 20:23   ` Neil Jerram
2010-07-10  8:22     ` Andy Wingo [this message]
2010-07-12 20:24       ` Linas Vepstas
2010-07-17 12:24         ` Andy Wingo
2010-07-12  8:09 ` Cedric Cellier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3ocefoiew.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=guile-user@gnu.org \
    --cc=neil@ossau.uklinux.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).