title: System.exit is not thread-safe on Linux?
body: <p>I've just switched from Oracle JDK 1.6, to Open JDK 1.7.0_03, and I've hit a rather remarkable deadlock on exit:</p>
  
  <pre><code>java.lang.Thread.State: WAITING (on object monitor)
   at java.lang.Object.wait(Native Method)
   at java.lang.Thread.join(Thread.java:1258)
   - locked &lt;0x8608dda0&gt; (a sun.awt.X11.XToolkit$1$1)
   at java.lang.Thread.join(Thread.java:1332)
   at java.lang.ApplicationShutdownHooks.runHooks(ApplicationShutdownHooks.java:106)
   at java.lang.ApplicationShutdownHooks$1.run(ApplicationShutdownHooks.java:46)
   at java.lang.Shutdown.runHooks(Shutdown.java:123)
   at java.lang.Shutdown.sequence(Shutdown.java:167)
   at java.lang.Shutdown.exit(Shutdown.java:212)
   - locked &lt;0x8603df28&gt; (a java.lang.Class for java.lang.Shutdown)
   at java.lang.Runtime.exit(Runtime.java:107)
   at java.lang.System.exit(System.java:960)
  </code></pre>
  
  <p>It appears that you must call System.exit from the AWT event queue. Is this for real? There is no documentation of a thread requirement in the Sun docs <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#exit%28int%29" rel="noreferrer">Runtime.exit</a></p>
  
  <p>I've hit other surprising cases where getting the AWT tree lock is required only on Linux, but this one takes the cake. Is this a bug, or have I just missed something in the documentation?</p>