I am trying to show progress while I am reading an excel file. I share an Object that contains the maximum row number and the last row number read.
Every 150 rows I save the value in my object, I put it to wait and my reading is stopped until the object is unlocked.
In my dialog window I try to update the ProgressBar using syncExec or asyncExec methods with values within the Object. And the Object is unlocked just after calling the methods.
I know that those methods are waiting for the most “suitable” occasion to run there runnables. However what I do not seem to understand is, why those methods are not executed if there is nothing running while they are called?
My actual situation is that asyncExec updates the ProgressBar only at the end of the reading process and synExec hangs the application, because it cannot execute while Object#wait is running.
Thanks for reading and more thanks for answering.
The next reasonable opportunity happens when your runnable reaches the head of the event loop’s queue. The event loop runs all the time while there are runnables waiting in it. I suspect you are deadlocking the event loop’s thread.