Hello,
Threads create there own copy of method they call. But its us who decide the data members/variables used in that function are inside the scope of function or from outside... For eg:
Class A
{
int inta;
public void someOperation()
{
.... Code to do some operations on variable inta
}
}
In above case , Threads will have difference copy of function but the variable used by all copy of function is common. so you need to maintain concurrency of value for variable inta.
another example :
<pre lang="c#">
class b
{
public voidSomeOperation()
{
int intb;
.... code performing some operation on intb;
}
}
In above case there isn't any need to maintain concurrency as there will be separate copy of whole function and function is using local variable.
Let me know if answer was useful for you.