guile-devel
[Top][All Lists]
Advanced

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

Re: allocation within critical sections


From: Andy Wingo
Subject: Re: allocation within critical sections
Date: Sun, 19 Feb 2012 22:29:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

On Sun 19 Feb 2012 21:56, address@hidden (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/



reply via email to

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