Index: smoke/gc/ThreadSuspension.java =================================================================== --- smoke/gc/ThreadSuspension.java (revision 541041) +++ smoke/gc/ThreadSuspension.java (working copy) @@ -29,20 +29,25 @@ public class ThreadSuspension implements Runnable { static boolean passed = false; + static boolean suspended2 = true; + static boolean suspended3 = true; + static Thread x1, x2, x3; public static void main (String[] args) { - Thread x1 = new Thread(new ThreadSuspension(1)); + x1 = new Thread(new ThreadSuspension(1)); x1.setDaemon(true); x1.start(); - Thread x2 = new Thread(new ThreadSuspension(2)); + x2 = new Thread(new ThreadSuspension(2)); x2.setDaemon(true); x2.start(); - Thread x3 = new Thread(new ThreadSuspension(3)); + x3 = new Thread(new ThreadSuspension(3)); x3.setDaemon(true); x3.start(); + //wait for large timeout interval try { synchronized(x1) { - x1.wait(3000); + x1.wait(); } } catch (Throwable e) {} if (passed) { + //VM successfully suspended the threads trace("PASS"); } else { trace("FAIL"); @@ -59,10 +64,16 @@ try { Thread.sleep(1000); } catch (Throwable e) {} trace("forcing gc after 1 s delay"); System.gc(); - trace("gc completed"); - passed = true; - synchronized (this) { - notify(); + if(suspended2 && suspended3) + { + //VM suspendeded both the threads + trace("gc completed"); + passed = true; + } + else + passed = false; + synchronized (x1) { + x1.notify(); } break; case 2: @@ -72,6 +83,7 @@ j = 1000 + j/(i+1); } trace("-- unsuspendable computation finished --"); + suspended2 = false; break; case 3: trace("-- starting suspendable computation --"); @@ -79,6 +91,7 @@ Thread.yield(); } trace("-- suspendable computation finished --"); + suspended3 = false; break; } }