I am writing an Eclipse RCP application in which multiple threads will update the user on progress each through its own progress bar in the GUI. I have been told that to allow each to individually update its own progress bar is to potentially cause a conflict over a shared resource (one of the parent the progress bars such as the Shell, I suppose). Is this true?
It was suggested to me that I created an intermediary class with synchronized methods that will act as a serializing funnel for update calls from the threads. Is this a solution? Can you offer a better solution?
It is actually pretty easy. Whenever you need to update the progress bar from any of the threads, you enclose the update code in
display.asyncExec(new Runnable() { .... });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With