[Top][All Lists]

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

Re: Emacs design and architecture. How about copy-on-write?

From: Ihor Radchenko
Subject: Re: Emacs design and architecture. How about copy-on-write?
Date: Fri, 22 Sep 2023 16:27:49 +0000

Eli Zaretskii <eliz@gnu.org> writes:

>> 2. Thread sets global variable value and uses it later, expecting the
>>    value to remain constant.
> This is the problem to solve.

My suggestion is to (1) create a thread-local copy of a global variable
value at the moment a thread reads/writes that global variable; (2) If a
thread writes a global variable, write the thread-local value back to
global when the thread terminates.

IMHO, this approach will keep all the existing Elisp working.

And if some new Elisp wants to set global value which running
concurrently, introduce a new API.

>> 3. Thread let-binds global variable.
> This is already solved in the current Lisp threadfs.

Not really. Current Lisp threads (1) specbind the old value
thread-locally; (2) set symbol value globally; (3) unwind/rewind when
switching between threads.

The global symbol value is directly modified, which won't fly for
concurrent threads.

That said, AFAIU, Po Lu knows how to address this particular problem.

Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

reply via email to

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