I have an application that has a main UI and two modeless windows that run on the their own separate thread. When passing an object from thread to thread I just make a copy of of the object running on the main thread on the secondary thread. When I want to update the object itself and have that changed perpetuated down through the code and to the secondary thread how do I make this happen??? The secondary thread always keeps a copy of the old object and never updates unless the thread is killed or stopped and then spawned again.
Share
There are a number of ways to tackle this. One would be a thread-safe shared instance of a repository for the object. When one thread updates it, the others would get an updated copy. You could use WCF to make this easy. See this article on WCF and concurrency for some ideas. This is an implementation of @Eric J’s comment to your question.
Another would be to coordinate the threads via events. When one thread updates the object, an event is sent to the others. If the object doesn’t change that often, it may be enough.
This question talks about a third possibility:
BackgroundWorker.