Problem with running thread a second time

Put your problem here if it does not fit any of the other categories.

Problem with running thread a second time

Postby nuisanceValue » Mon Jul 05, 2010 5:12 pm


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?

Posts: 7
Joined: Thu Jun 24, 2010 12:40 am


Re: Problem with running thread a second time

Postby anarche » Tue Jul 06, 2010 3:08 am

Read the API

Firstly well done for using a second thread in the appopriate place. Secondly have you studied concurrency? This is where that knowledge is appropriate...
Master Developer
Master Developer
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am


Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 12 guests