changeset 6195:34b49805adf8

8000817: Reinstate accidentally removed sleep() from ProcessBuilder/Basic.java Reviewed-by: alanb, martin
author robm
date Mon, 15 Oct 2012 03:26:11 +0100
parents b820ea0283df
children eb23e6bd0d71
files test/java/lang/ProcessBuilder/Basic.java
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test/java/lang/ProcessBuilder/Basic.java	Thu Oct 11 18:24:38 2012 +0100
+++ b/test/java/lang/ProcessBuilder/Basic.java	Mon Oct 15 03:26:11 2012 +0100
@@ -40,6 +40,7 @@
 import java.util.*;
 import java.util.concurrent.CountDownLatch;
 import java.security.*;
+import sun.misc.Unsafe;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 import static java.lang.System.getenv;
@@ -1930,6 +1931,7 @@
 
                 thread.start();
                 latch.await();
+                Thread.sleep(10);
 
                 String os = System.getProperty("os.name");
                 if (os.equalsIgnoreCase("Solaris") ||
@@ -1954,6 +1956,15 @@
                     while (useCountField.getInt(deferred) <= 0) {
                         Thread.yield();
                     }
+                } else if (s instanceof BufferedInputStream) {
+                    Field f = Unsafe.class.getDeclaredField("theUnsafe");
+                    f.setAccessible(true);
+                    Unsafe unsafe = (Unsafe)f.get(null);
+
+                    while (unsafe.tryMonitorEnter(s)) {
+                        unsafe.monitorExit(s);
+                        Thread.sleep(1);
+                    }
                 }
                 p.destroy();
                 thread.join();