Re: state of variable accessed by thread
Saturday, April 20, 2002 01:09 AM
If the variable is declared inside the method, each invokation of the metod will have a separate instance,then the variable is thread safe.
If the variable is declared as member instance and many threads access the same object of that class, the variable should be accessed with synchronization.
If the variable is declared as static member instance and many threads access different instances of the class, the variable is again shared between threads, and needs to be synchronized.