emacs-devel
[Top][All Lists]
Advanced

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

Re: advice needed for multi-threading patch


From: Stefan Monnier
Subject: Re: advice needed for multi-threading patch
Date: Wed, 26 Aug 2009 15:18:06 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

> I'm trying to properly implement per-thread let binding in the presence
> of buffer-local variables.

The problem with that is that we first need to figure out what its
semantics should be.  And to me the semantics of a let-bound
buffer-local variable is very much unclear in the presence of threads
(it's already pretty messy even without threads).

So I'd rather disallow other threads from accessing this buffer's
variable while the let-binding is active.

> I was planning to do this by inserting a thread-based lookup anywhere a
> buffer-local was accessed.  However, to do this, I need to insert a
> function call anywhere a field corresponding to a DEFVAR_PER_BUFFER is
> used.

> So, e.g., I would like to change:

b-> major_mode = Qfundamental_mode;

> to:

>     BUFFER_MAJOR_MODE (b) = Qfundamental_mode;

> Doing this transform for all 54 DEFVAR_PER_BUFFER fields is a big pain,
> though, so I thought I'd ask about it first.

This may have a very significant performance impact.  Now, maybe we'll
have to bite the bullet sooner or later.  But I'd rather not yet.
This said, I'd accept a patch that turns all

     .... b->major_mode ...
into
     .... PER_BUFFER_VAR (b, major_mode) ...

or even with two different macros (one for lvalue, and one for rvalue).


        Stefan




reply via email to

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