On 02/01/19 20:08, Martin wrote:
If a local string var has a refcount of 1, then it can not be accessed by any other thread. Therefore it needs no lock for decreasing the ref.

You would need a full memory barrier before checking whether the reference count is one, otherwise it could have been increased to two by another thread on another core quite a while ago without that change being already visible on the current core. This would probably slow down things much more than any potential gain from not performing the atomic decrement.


Jonas
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to