• Post Reply Bookmark Topic Watch Topic
  • New Topic

main thread  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there the possibility that the main thread would complete execution before all the child threads it has started complete execution. If this does happen then how would I have to handle such a scenario
thanks
gowtham
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Yes the scenario exists but remember that the main thread is a user thread not a daemon thread as such any thread that it creates is in fact a user thread. one does not need to handle such a scenario as the process will not be complete till all the user threads have done their job. once all the user threads have completed their run() the process exits even though Daemon threads my be running.
one can set the thread created to daemon specifically by setDaemon(true). In such a scenario the process exits once the main thread exits.
Regds.
Rahul
[This message has been edited by rahul_mkar (edited July 28, 2000).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!