I have a multithreaded application. The thread manager contains a list of objects of dbNodeList
class dbNodeList
{
public string nodepath;
public string nodename;
public string nodevalue;
//etc...
}
In the ThreadManager the nodepath and nodename are constants that are pre populated. In the working thread the nodevalue is pulled out of the xml message it is processing.
When the threadmanager launches a new thread it needs to give the thread a true copy of this list so when the nodevalue is filled in it is unique to that thread.
So when launching a thread I can't just say
NewThread.nodeList = ThreadManager.nodeList; as I think that is just setting a reference to the TheadManager's list. If thread_1 sets the nodevalue and then thread_2 sets it to another value, won't it be incorrect in thead_1 now?
Thanks, Rut