emacs-devel
[Top][All Lists]
Advanced

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

Re: save-excursion and multi-thread?


From: Eli Zaretskii
Subject: Re: save-excursion and multi-thread?
Date: Sun, 26 Sep 2021 22:14:43 +0300

> From: Qiantan Hong <qhong@mit.edu>
> CC: Tassilo Horn <tsdh@gnu.org>, Eli Zaretskii <eliz@gnu.org>
> Date: Sun, 26 Sep 2021 19:09:42 +0000
> 
> (defvar x 5)
> (make-thread
>  (lambda ()
>    (let ((x 7))
>      (sleep-for 1))))
> x ;; => still 5 within this 1 second, by C-x C-e (which runs in main thread)
> 
> I think maybe the confusion is from different terminology to call special 
> variable (in Common Lisp terms),
> maybe you simply call it global variable or dynamic variable?

As documented in the ELisp manual, let-bindings are thread-local.

> Isn’t all global/dynamic variable thread local, as in the example above?

No, only the let-bindings are.  And also the regexp search-related
stuff, so that you could have independent searches in each thread.



reply via email to

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