John wrote:
> Does this mean that reference counting increase/decrease is > thread-safe (or perhaps atomic operation?)
Yes. String reference counts are protected by the RTL itself using its own locks.
> even though the actual UnicodeString data payload management isn't?
Only one thread can create a new string payload, and it is initialized with a reference count of 1. Only one thread can decrement the reference count to 0, and that is the last thread to touch the payload, so that is the thread that frees it.
> I did test accessing data from 2 threads when it was being written > from one and read from another and I do get access violation so it > doesn't seem thread safe
It depends on what you were doing exactly. Please show your actual code.
-- Remy Lebeau (TeamB)