From: Andy Wingo <wingo@pobox.com>
To: ludo@gnu.org (Ludovic Courtès)
Cc: "guile-devel@gnu.org" <guile-devel@gnu.org>
Subject: Re: allocation within critical sections
Date: Sun, 19 Feb 2012 22:29:40 +0100 [thread overview]
Message-ID: <87vcn2zf3v.fsf@pobox.com> (raw)
In-Reply-To: <8739a6y23d.fsf@gnu.org> ("Ludovic Courtès"'s message of "Sun, 19 Feb 2012 21:56:06 +0100")
On Sun 19 Feb 2012 21:56, ludo@gnu.org (Ludovic Courtès) writes:
>>> What about using asyncs for that? For instance, scm_i_finalize_smob
>>> make a [deferred], instead of direct, call to the SMOB’s ‘free’, via
>>> scm_i_queue_async_cell.
>>
>> It's an interesting idea. I suspect that it only defers the problem,
>> though: if we start running finalizers through asyncs, we'll run into
>> problems with locks at the scheme level.
>>
>> That is to say, just because you are in Scheme does not mean you can
>> acquire any lock without deadlock.
>
> Sure, but the libguile-level lock issue would go away, wouldn’t it?
Does it?
libguile takes a lock
libguile calls a function within the lock (e.g. from a smob finalizer)
an async runs while the scheme function runs
a finalizer runs, potentially grabbing the lock that libguile has
Maybe this can be avoided somehow. Don't call functions while holding
locks? Seems very tricky, especially when you get third-party code into
the mix.
However I think that this discussion is not attacking the fundamental
problem. It should be OK for Scheme code to take locks. Or do you have
some other plan for concurrency in Guile?
Andy
--
http://wingolog.org/
next prev parent reply other threads:[~2012-02-19 21:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 19:15 allocation within critical sections Andy Wingo
2012-02-13 10:38 ` Andy Wingo
2012-02-13 15:29 ` Andy Wingo
2012-02-16 21:30 ` Ludovic Courtès
2012-02-16 22:27 ` Andy Wingo
2012-02-17 2:46 ` Mike Gran
2012-02-17 8:16 ` Andy Wingo
2012-02-17 10:32 ` Mike Gran
2012-02-17 15:20 ` Andy Wingo
2012-02-17 22:59 ` Ludovic Courtès
2012-02-19 9:42 ` Andy Wingo
2012-02-19 20:56 ` Ludovic Courtès
2012-02-19 21:29 ` Andy Wingo [this message]
2012-02-24 15:04 ` Andy Wingo
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=87vcn2zf3v.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=guile-devel@gnu.org \
--cc=ludo@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).