[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bug: defining things in different threads
From: |
Linas Vepstas |
Subject: |
Re: bug: defining things in different threads |
Date: |
Sat, 15 Nov 2008 17:36:49 -0600 |
Hi Neil,
Thanks for the reply,
2008/11/15 Neil Jerram <address@hidden>:
> 2008/11/12 Linas Vepstas <address@hidden>:
>
>> Yes, of course, the problem remains.
>
> Explanation:
>
> Thread 1 is the first thread that does any Guile stuff, so it loads
> boot-9.scm, which means that it ends up in the (guile-user) module.
>
> Thread 2 hasn't done any (set-current-module ...), so it stays at the
> default, which is (guile).
>
> Solution: add (define-module (guile-user)) to the code that you
> execute in thread 2.
Well, originally, my code loaded a smob interface
(defined a bunch of smobs) in thread 1, which I then
found to be undefined in thread 2 (and all subsequent
threads). Would your fix solve this?
Under the "principle of least surprise", I certainly was
surprised that not all threads behaved the same; I got
bitten by this, and wasted a day debugging this, and
designing a work-around for this "feature". I would
like to suggest that libguile itself should be performing
this step, rather than having the developer get caught
off -guard and scratching their head.
--linas