On Oct 23, 12:19 am, Ian Collins <ian-n...@hotmail.comwrote:
That's a bit light for a description of thread safe. Use use of static
member functions implies the use of static data members, accessing these
from multiple threads can also cause problems.
To the OP, with regards to thread safety, consider static members in the
same was a globals (functions and data). Apply the same thread safety
rules.
The class contains NO static member variables.
<babble>
What I was initially unsure of was if the existence of just one copy
of the each static function implied sharing, which naturally brought
the question of thread-safety to mind.
But I recall that, all classes static or otherwise have only one copy
of their member functions (if non static, such a member function has
an additional/implicit "this" pointer to the object that called the
function) irrespective of the number of instances of the class.
My conclusion (please correct me if I'm wrong): each call to a static
member function creates new copies the function's local variables on
the stack, so that context switches between threads cannot corrupt
local variables. Recall that the class itself contains member
variables static or otherwise.
</babble>