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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top