< prev index next >

test/hotspot/jtreg/vmTestbase/nsk/stress/thread/thread006.java

Print this page
rev 56807 : [mq]: 8232684-v2


 159             return 2;
 160         }
 161         STOP = true;
 162 
 163         if (DEBUG_MODE)
 164             out.println("The test have PASSED.");
 165         return 0;
 166     }
 167 
 168     private static boolean GO = false;
 169     private static boolean STOP = false;
 170 
 171 
 172     /**
 173      * The thread activity: do nothing special, but do not
 174      * free CPU time so that the thread's memory could not
 175      * be moved to swap file.
 176      */
 177     public void run() {
 178         while (!GO && !timeout())
 179             yield();
 180         while (!STOP && !timeout())
 181             ;
 182     }
 183 
 184     private static long startTime = System.currentTimeMillis();
 185 
 186     /**
 187      * Check if timeout for this test is exceeded.
 188      */
 189     private boolean timeout() {
 190         long elapsedTime = System.currentTimeMillis() - startTime;
 191         return elapsedTime > TIMEOUT;
 192     }
 193 
 194     /**
 195      * Yield to other threads for the given amount of
 196      * <code>time</code> (milliseconds).
 197      */
 198     private static void doSleep(long time) throws InterruptedException {
 199         //


 159             return 2;
 160         }
 161         STOP = true;
 162 
 163         if (DEBUG_MODE)
 164             out.println("The test have PASSED.");
 165         return 0;
 166     }
 167 
 168     private static boolean GO = false;
 169     private static boolean STOP = false;
 170 
 171 
 172     /**
 173      * The thread activity: do nothing special, but do not
 174      * free CPU time so that the thread's memory could not
 175      * be moved to swap file.
 176      */
 177     public void run() {
 178         while (!GO && !timeout())
 179             Thread.yield();
 180         while (!STOP && !timeout())
 181             ;
 182     }
 183 
 184     private static long startTime = System.currentTimeMillis();
 185 
 186     /**
 187      * Check if timeout for this test is exceeded.
 188      */
 189     private boolean timeout() {
 190         long elapsedTime = System.currentTimeMillis() - startTime;
 191         return elapsedTime > TIMEOUT;
 192     }
 193 
 194     /**
 195      * Yield to other threads for the given amount of
 196      * <code>time</code> (milliseconds).
 197      */
 198     private static void doSleep(long time) throws InterruptedException {
 199         //
< prev index next >