Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

effect over JVM  RSS feed

 
Pawar Santoshkumar
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As i raised one question earlier about control over main thread.

If main thread completes execution before its child threads what will Happen.
Can JVM hang or something like it.

Please tell me.
[ July 31, 2006: Message edited by: pawar santosh ]
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JVM will exit IF all the other threads that are alive at that point are daemon threads. Threads created from the main thread (i.e., directly by the application) are typically not daemon threads, though, so the JVM will wait until those threads die before exiting. (If a GUI has been created, then the event handling thread is also not a daemon thread.)
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Having said that, there is no connection between a "child" and a "parent" thread (other than that they run in the same thread group by default).
 
akshay sanganwar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use t.join() method
 
Ken Blair
Ranch Hand
Posts: 1078
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by akshay sanganwar:
You can use t.join() method



Okay...
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!