This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

join() and start() order making the differnce

 
Sahil Kapoor
Ranch Hand
Posts: 316
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi savvy pals,

Why does the following two codes making a difference.






Why second code is not behaving like the first ??? Cannot we join first and then start.

Thanks !!!
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can only meaningfully call join() on a thread that has already been started. join() waits for the thread to finish, and then returns. Calling it before a thread even starts is obviously not going to work. If it did work -- i.e., if it didn't return until the thread was finished -- then you'd never get to the next statement to call start(), right? So the thread would never run at all.
 
Sahil Kapoor
Ranch Hand
Posts: 316
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks ernest !!!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic