If you instantiate a Thread is it possible to keep interrupting and starting it with no consequences? I want to be able to re-start the run() method numerous times. Thanks. Paul
Martin webster
Greenhorn
Joined: Jun 20, 2001
Posts: 20
posted
0
From what I understand.. Once a thread is dead it is dead. You can't bring it back into the world of the living. You would have to create a new instance of the thread.
Martin
Yuri Gadow
Greenhorn
Joined: May 08, 2001
Posts: 28
posted
0
Once a run method is complete, the thread cannot be restarted, period. However, you can change the approach a bit to achieve the same effect. One (of many) ways is to have your run loop on a condition, wait on a shared monitor upon completion, and then use a notify to "restart" it - think work queue. I have some source I can post this evening if it would be helpful.