Suppose i have a class with a global variable a method and couple of threads.
class Class
{
public var Var1;
piblic mainFoo()
{
thread1.start(thread_foo1);
thread2.start(thread_foo2);
}
public void Foo(var1, var2, var3)
{
...
}
private thread_foo1()
{
if(Var1) {}
Foo(_var1,_var2,_var3);
}
private thread_foo2()
{
if(Var1) {}
Foo(_var1,_var2,_var3);
}
}
Var1 is not changed anywhere but the main thread. Foo does not change any data in any of threads, it's just some small common code that i do not want to repeat. Will this structure cause any problems or conflicts in the threads?