This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes start() method, revisited after thread stops ? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "start() method, revisited after thread stops ?" Watch "start() method, revisited after thread stops ?" New topic
Author

start() method, revisited after thread stops ?

sarim raza
Ranch Hand

Joined: Nov 02, 2000
Posts: 232
I have a start method
start()
{
// threads initialized here
}
run()
{
// threads execute here, and run in some loop
}
otherMethod()
{
// this sets the condition for threads to run false, so all threads will stop
}

Question: will execution of program go back to the
end of start() method ?
thanks
Snigdha Solanki
Ranch Hand

Joined: Sep 07, 2000
Posts: 128
A thread dies at the natural termination of run method. Consider the following code:

Thread having the above run method will print value of i 100 times and exit. It will not go back to the method which started the thread.


Snigdha<br />Sun Certified Programmer for the Java™ 2 Platform
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: start() method, revisited after thread stops ?
 
Similar Threads
Threads !
When will my thread sublclass be gc'ed
How can i start multiple threads ??
Threads !
thread doesn't seem to be work?