So far, we have been working with parallelized algorithms splitting jobs into pieces, job dispatchers using pools of threads, and C# programming language object-oriented capabilities applied to concurrency. The BackgroundWorker component was always there to help us in providing feedback to the user interface. However, using loops in the BackgroundWorker to synchronize the changes in the threads to update the user interface is annoying. Some applications need to update the user interface at specific times known by the independent threads, which are unable to make direct changes to the UI controls. How can we make changes to the user interface from any independent thread without causing problems and without using BackgroundWorker loops? Is it possible to do that?
Yes, and it is very simple to do that for any independent thread. It doesn't matter if it was created as a new Thread
instance or as a worker thread in the ThreadPool
class.