Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Threads

 
Amudha
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Should the main thread be the last to be executed as few books say.What would happen if my main thread was not the last thread that was executed
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Executed or started?
Think of Java as a multi-threaded environment. If thread A starts thread B and then thread A ends, thread B may still be executing. No problem.
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amudha:
Should the main thread be the last to be executed as few books say.What would happen if my main thread was not the last thread that was executed

it totaly depends on operating system if u r woorking in Windows Environment ,there is no problem but if ur working other os than it may problem becoz it terminates the child thread as soon as main thread exits and that may lead to file coorupted,data corruption on which ur child thread is operating on.So it is always advisable to use Join() .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic