[fpc-devel] ref count types / threadsave question

Martin Frb lazarus at mfriebe.de
Wed Jan 2 22:00:23 CET 2019


On 02/01/2019 21:52, Jonas Maebe wrote:
>
> This is a different issue. Managed types are indeed only threadsafe as 
> long as there is no race condition that could cause their refcount to 
> become zero at some point.
>
> 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.
Yes, I did drop the optimization idea after your first reply.




More information about the fpc-devel mailing list