From: <cap...@us...> - 2007-09-26 21:01:39
|
Revision: 13695 http://jikesrvm.svn.sourceforge.net/jikesrvm/?rev=13695&view=rev Author: captain5050 Date: 2007-09-26 14:01:35 -0700 (Wed, 26 Sep 2007) Log Message: ----------- Fix bug where threads running shutdown hooks would call System.exit during termination and cause deadlock (RVM-154). Modified Paths: -------------- rvmroot/trunk/rvm/src/org/jikesrvm/scheduler/VM_Thread.java Modified: rvmroot/trunk/rvm/src/org/jikesrvm/scheduler/VM_Thread.java =================================================================== --- rvmroot/trunk/rvm/src/org/jikesrvm/scheduler/VM_Thread.java 2007-09-26 15:19:06 UTC (rev 13694) +++ rvmroot/trunk/rvm/src/org/jikesrvm/scheduler/VM_Thread.java 2007-09-26 21:01:35 UTC (rev 13695) @@ -388,6 +388,11 @@ public boolean requesting_osr = false; /** + * Is the system in the process of shutting down (has System.exit been called) + */ + private static boolean systemShuttingDown = false; + + /** * @param stack stack in which to execute the thread */ protected VM_Thread(byte[] stack, Thread thread, String name, boolean daemon, boolean system, int priority) { @@ -660,7 +665,6 @@ VM_Scheduler.dumpStack(); VM.sysWriteln("END Verbosely dumping stack at time of creating thread termination ]"); VM.enableGC(); - } if (VM.BuildForAdaptiveSystem) { @@ -691,13 +695,19 @@ // no non-daemon thread remains and the main thread was launched terminateSystem = true; } + if (terminateSystem) { + if (systemShuttingDown == false) { + systemShuttingDown = true; + } else { + terminateSystem = false; + } + } if (traceTermination) { VM.sysWriteln("VM_Thread.terminate: myThread.daemon = ", daemon); VM.sysWriteln(" VM_Scheduler.numActiveThreads = ", VM_Scheduler.numActiveThreads); VM.sysWriteln(" VM_Scheduler.numDaemons = ", VM_Scheduler.numDaemons); VM.sysWriteln(" terminateSystem = ", terminateSystem); } - // end critical section // VM_Processor.getCurrentProcessor().enableThreadSwitching(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |