Periodically call method within my worker threads

I am creating multiple different threads from a single manager class. I now need to periodically update each thread by calling a function within it. What is the best approach? The thread has a reference to the manager class so I was thinking to pass back a function to the manager from within the thread, but that doesn't seem right, surely there is a better way. I looked at Dispatcher class but this didn't seem right either. Can anyone recommend the best approach to this?

account = new Account(this);
Thread accountThread1 = new Thread(new ThreadStart(account.Run));
Thread accountThread2 = new Thread(new ThreadStart(account.Run));

accountThread1.Start();
accountThread2.Start();

// How do I call method on accountThread1 or 2?


#c-sharp #.net #multithreading #asp.net

5 Likes2.45 GEEK