0

I have a class (nodelist) and I'm creating a list of these in my thread manager class.

The worker class (for the threads) contains a property of this type of list.

When I create the thread I set the worker class' property = the list from the thread manager class.

My question is, with multiple threads running, if one thread changes the value of its list, is that affecting the list in the other threads or are they truely unique to each thread?

If not then how do I make them unique?

rut
  • 73
  • 5

1 Answers1

0

The lists will not be unique, nor will the objects that they contain. You are describing a case where there is only one list, but with multiple references to it. When you ask, "how do I make the unique?", you could be more specific. You can have unique lists that contain pointers to a common set of objects, or can have unique lists with pointers to unique (cloned) objects. This StackOverflow question has an extensive discussion on this topic.

Community
  • 1
  • 1
JerryM
  • 910
  • 6
  • 9