I am writing an app that at one point reads in a list of people from a file and geocodes their addresses (to make it easier to put them on a map later).
I am using a separate thread for the geocoding and I have a progress indicator to show progress (funnily enough!). The progress indicator is a bar and increments for each address coded until they are all done.
This all works just fine. The problem arises if I try to load the file a second time. The progress indicator pops up but it is already full and nothing seems to happen (I have left it sitting there for a while just in case it was only a problem with the progress indicator).
I searched through this forum and found the following:
by ErnestoGuevara » Thu Jan 08, 2009 3:56 pm
Start() will never be valid again on a thread that has already been started, even if it successfully finished its run() method.
Busy waiting is likely to be expensive - you're either causing unnecessary context switches or evaluating a condition as often as possible.
Better to use signaling - wait/notify.
So can someone help me with this?
What is the easiest way to reset the thread so that it does the work again if I can't actually restart it?