Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

start() method, revisited after thread stops ?

 
sarim raza
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!