[Top][All Lists]

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

Re: Concurrency via isolated process/thread

From: Eli Zaretskii
Subject: Re: Concurrency via isolated process/thread
Date: Thu, 06 Jul 2023 17:13:07 +0300

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
> Date: Thu, 06 Jul 2023 13:13:07 +0000
> Po Lu <luangruo@yahoo.com> writes:
> >>>>    LOCK_OBJECT (foo);
> >>>>    LOCK_OBJECT (XCAR (foo));
> >>> ...
> >> ...
> >> Do you mean that locking XCAR (foo) is unnecessary when foo is locked?
> >
> > No, that there is no need to lock a cons (or a vector, or anything else
> > with a fixed number of Lisp_Object slots) before reading or writing to
> > it.
> I feel confused here.
> My understanding is
>   CHECK_STRING (XCAR (foo));
>   <we do not want XCAR (foo) to be altered here>
>   foo = XSTRING (XCAR (foo));
> So, locking is needed to ensure that CHECK_STRING assertion remains valid.
> Or did you refer to something else?

I don't know what Po Lu had in mind, but one aspect of this is that a
string object might keep its memory address, but its data could be
relocated.  This can happen as part of GC, and is the reason why
string data is kept separate from the string itself.

reply via email to

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