If you have thread local static variables (i.e. static variables with
the ThreadLocalAttribute applied), they're thread-safe by definition.
Of course, if they have values which are references to objects which
are used in multiple threads, then manipulating those objects needs to
be made thread-safe, but the variables themselves are thread-safe.
I don't know what ThreadLocalAttribute is. There is no information on such
an attribute in the docs (or at least I can't find it).
If this is what I think it is - to create thread bound data using thread's
data slots, I wouldn't say that static variables marked with
ThreadLocalAttribute are thread safe. As I understand thread safety is that
more than one thread can manipulate the variable without collision. If the
data is thread bound that means it exist only for sepcific thread. In this
case no other thread can use that data. This is no thread safety because
only one thread can use the data.
My answer to the question is - No, static variables by themselves are not
thread safe.
--
HTH
Stoitcho Goutsev (100)