Problem with keeping track of threads.

  • Thread starter Thread starter Joshua Russell
  • Start date Start date
J

Joshua Russell

I'm writing some software that opens multiple instances of a single class in
new threads. I need a way of keeping track of all these class instances in
some kind of collection. I'm basicaly writing an MSN Messenger like
application. The threads being, in this case, the chat windows. I would like
to be able to access the various referances in a similar way to the
following if it can be done...
convoThreads["(e-mail address removed)"].someFunctionInTheClass();

Has anyone got anyideas how I can do this?

Thanx Josh
 
So long as convoThreads is a singleton accessed in a thread-safe manner,
this should be fine. For the collection class you are using, see it's
discussion of thread safety (hint: lock(theCollection) is insufficient for
thread safe usage of a collection).

Brad Williams
 
Back
Top