[Top][All Lists]

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

Re: Are there plans for a multi-threaded Emacs?

From: Stefan Monnier
Subject: Re: Are there plans for a multi-threaded Emacs?
Date: 03 Dec 2003 15:29:42 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

> And anything doing similar things using dynamic scope as well (at
> least when a variable isn't local to the function but from a
> previously called function). So that's about everything.

I think the nastiest aspect I know of is the interaction of dynamic scope
with buffer-local bindings:

  (with-current-buffer A
    (setq default-directory fooA)
    (let ((default-directory barA))
      (with-current-buffer B
        (setq default-directory fooB)
        (let ((default-directory barB))
          (with-current-buffer A default-directory)))))

This will return `barA': i.e. the value of default-directory in buffer A is
temporarilly changed to barA.  But this is a "global" variable (from
a threading point of view) changed by a let-binding (generally considered
as a thread-local, stack-allocated variable).

So I think fine-grained threading in elisp is basically out.
But maybe if we add one lock per buffer and we make `with-current-buffer'
acquire&release the lock we might get a workable model, albeit with
a necessarily very coarse grain which is probably OK for most uses.
Of course, extreme care will still be needed, but that's OK.


reply via email to

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