[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: Emanuel Berg
Subject: Re: Emacs design and architecture. How about copy-on-write?
Date: Fri, 22 Sep 2023 16:22:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii wrote:

>>> If we need to lock 99.99% of Emacs "single" variables, it
>>> is easier to lock everything. Faster, too.
>> Why do we need to do that?
>> For one thread, one write operation, and one variable, only
>> that variable has to be locked?
>> (operate-on var1) ; here we need a lock on var1
>> (operate-on var2) ; etc
> We don't have 'operate' in Emacs, but we do have setq, setf,
> and others. Where do you locak and where do you unlock in
> that case?
> Just try to write a simplest Lisp program, and you will see
> the problem.

There is no way around it, in order to prevent a race
condition any global variable must be locked before it's value
can be altered.

So `setq', `setf' and any other setter of global variables
must first be refered to the locking mechanism where they
either acquire the lock, perform the write, and release the
lock; or, if the variable is already locked by some other
thread wanting to do the same thing, they must be queued so
they will get it in due time.

underground experts united

reply via email to

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