From: Mark H Weaver <mhw@netris.org>
To: Panicz Maciej Godek <godek.maciek@gmail.com>
Cc: guile-user@gnu.org
Subject: Re: libguile thread safety
Date: Sun, 05 Jan 2014 12:37:29 -0500 [thread overview]
Message-ID: <87k3eexrc6.fsf@netris.org> (raw)
In-Reply-To: <CAMFYt2Ziymo4eFJgiDGuWOuwVOwb=G_MXKJd=rMu853rA7EP=w@mail.gmail.com> (Panicz Maciej Godek's message of "Sun, 5 Jan 2014 14:15:42 +0100")
Panicz Maciej Godek <godek.maciek@gmail.com> writes:
> 2014/1/5 Chris Vine <chris@cvine.freeserve.co.uk>:
>
>> I actually have a prototype working well now, apart from the module
>> issue Mark Weaver referred to, which I have to say has not yet bitten me
>> but no doubt might.
>
> If you are worried about this, you could try to take your own
> precautions and redefine the "use-modules" syntax (or others, like
> "resolve-module", if you are planning to use them) to make sure that
> it is thread safe.
>
> The sole act of redefinition would require you to create a new module like this:
> (define-module (safe-modules)
> #:use-module (ice-9 format)
> #:replace ((safe-use-modules . use-modules)))
>
> (define-syntax-rule (safe-use-modules modules ...)
> (begin
> (format #t "loading modules ~a... " '(modules ...))
> (use-modules modules ...)
> (format #t "done!\n")))
>
> You'd need to replace the the messages with some thread
> synchronization mechanism, to make sure that if one thread calls
> "use-modules", all the others that would try to do that at that time
> would have to wait.
This wouldn't work. First of all, 'use-modules' is a macro, not a
procedure, but more importantly, modules are autoloaded in many places
deep in the guts of the system. Notice that Chris' test cases didn't
use 'use-modules' at all. In fact, a module is autoloaded the first
time 'scm_c_eval_string' is called. Also, there are potential
deadlocks.
We should just fix the problem properly, and that's what I intend to do.
Mark
next prev parent reply other threads:[~2014-01-05 17:37 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-03 23:34 libguile thread safety Chris Vine
2014-01-04 0:00 ` Ludovic Courtès
2014-01-04 17:19 ` Chris Vine
2014-01-04 0:08 ` Panicz Maciej Godek
2014-01-04 0:22 ` Chris Vine
2014-01-04 0:56 ` Panicz Maciej Godek
2014-01-04 1:22 ` Panicz Maciej Godek
2014-01-04 9:39 ` Chris Vine
2014-01-04 21:28 ` Mark H Weaver
2014-01-04 1:59 ` Mark H Weaver
2014-01-04 9:50 ` Chris Vine
2014-01-04 12:44 ` Chris Vine
2014-01-04 15:01 ` Panicz Maciej Godek
2014-01-04 17:16 ` Chris Vine
2014-01-04 19:37 ` Mark H Weaver
2014-01-04 21:01 ` Chris Vine
2014-01-04 22:43 ` Panicz Maciej Godek
2014-01-04 23:31 ` Chris Vine
2014-01-05 13:15 ` Panicz Maciej Godek
2014-01-05 17:37 ` Mark H Weaver [this message]
2014-03-18 10:49 ` Chris Vine
2014-03-18 15:22 ` Mark H Weaver
2014-03-18 19:32 ` Chris Vine
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=87k3eexrc6.fsf@netris.org \
--to=mhw@netris.org \
--cc=godek.maciek@gmail.com \
--cc=guile-user@gnu.org \
/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).