Sharing data between threads of different methods
I am curious about the best way to share data between threads that aren't based on the same method.
For example, if I want to share the same string(by reference) between 2 threads:
Main()
{
string shareme;
Start New Thread based on A()
Start New Thread based on B()
shareme = "Updated in main";
}
A()
{
shareme = "Updated in A";
}
B()
{
shareme = "Updated in B";
}
Thanks