emacs-devel
[Top][All Lists]
Advanced

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

Re: Patch for fields of `struct buffer'


From: Richard Stallman
Subject: Re: Patch for fields of `struct buffer'
Date: Mon, 31 Jan 2011 14:38:15 -0500

    One easy one is whether a new thread should inherit thread-local
    bindings from its parent thread.  Our initial implementation did
    inherit, but later I found out that this is not common in the Lisp
    world.

    I.E., what should this display?

    (defvar var 0)
    (let ((var 1))
      (run-in-thread (lambda () (message "%d" var))))

You are talking about ordinary local bindings.  They would be
per-thread, but not specifically related to threading.

I would expect "thread-local bindings" to refer to a feature similar
to buffer-local bindings, and controlled through a similar set of
functions.  I think these should never be copied to a new thread,
just as buffer-local bindings are never copied to a new buffer.

As for local bindings in the thread, it might make sense to copy them
into the new thread when the function is a lambda, and not copy them
when the function is a symbol.  Or perhaps have two functions to start
a thread, `run-in-nested-thread' and `run-in-global-thread', to make
both options available.

Or maybe have a macro to start a new thread and copy the local bindings,

  (with-temp-thread body...)

while using a function to start a new thread with no local bindings.



-- 
Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org, www.gnu.org



reply via email to

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