P
Pesso
I have a worker thread, which returns a value (a System.Xml.XmlDocument
object) to the main WinForm thread. I tried the below, but I'm not sure if
it's done correctly.
public class Form1: System.Windows.Forms.Form
{
// ...
System.Xml.XmlDocument _xmldoc;
// ...
void Func1()
{
Thread workerthread = new Thread( new ThreadStart( Func2 ));
workerthread.Start();
}
void Func2()
{
SomeLib lib = new SomeLib(); // instantiate an object
_xmldoc = lib.LengthyOperation(); // Can I assign a return value from a
thread operation to a private data member like this without any
synchronization?
}
object) to the main WinForm thread. I tried the below, but I'm not sure if
it's done correctly.
public class Form1: System.Windows.Forms.Form
{
// ...
System.Xml.XmlDocument _xmldoc;
// ...
void Func1()
{
Thread workerthread = new Thread( new ThreadStart( Func2 ));
workerthread.Start();
}
void Func2()
{
SomeLib lib = new SomeLib(); // instantiate an object
_xmldoc = lib.LengthyOperation(); // Can I assign a return value from a
thread operation to a private data member like this without any
synchronization?
}