gettting a wait()'ing thread to run again



Hi, I have some code running which consists of a GUI. At one point, a long
running task must be executed. So the code looks like:

// some code

// progress monitor code
longTask.go()

// do something with the results of long task

The problem is, that the code that calls longTask.go() must wait for
longTask to finish. I created long task based on the examples for the
ProgressMonitor class on the Java website. However the difference is that
I must wait till the thread that longTask is in finishes.

So I modified it to:


// some code

// progress monitor code
longTask.go()

try {
this.wait()
} catch(..) {}

// do stuff with the results of long task

However, what I don't understand is how I can get the current thread (ie
the one that is waiting) to start running again once longTask has
completed.

I hope I've been able to describe the problem as I'm a newbie to threads.

Any pointers would be appreciated
Thanks,
Rajarshi


.