[fpc-devel] ref count types / threadsave question

Sven Barth pascaldragon at googlemail.com
Thu Jan 3 14:23:32 CET 2019


Am Do., 3. Jan. 2019, 13:25 hat Benito van der Zander <benito at benibela.de>
geschrieben:

> Hi,
>
>
>
> The issue I was talking about is the fact that atomic operations do
> function as global memory synchronisation operations across all cores (at
> least not on all architectures). If core 1 atomatically increases refcount
> to two and you "then" load the same refcount normally (without an atomic
> read-modify-exchange oepration) on another core, this other core may still
> see the old value.
>
>
> Is that really so?
>
> The ref count is stored in the same memory block as the string itself.
>
> If core 2 could not see the new ref count, it could not see what is in the
> string and thus not use the string for anything .
>

Nobody is talking about the string content. It's only about the reference
count right now and that one *can* differ between cores if that isn't
correctly handled (even if the string content stays the same).

Regards,
Sven

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20190103/2ea07374/attachment.html>


More information about the fpc-devel mailing list