8000817: Reinstate accidentally removed sleep() from ProcessBuilder/Basic.java

Reviewed-by: alanb, martin
This commit is contained in:
Rob McKenna 2012-10-15 03:26:11 +01:00
parent 037bcf1683
commit 2dca3dc06b

View File

@ -41,6 +41,7 @@ import java.util.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.security.*;
import sun.misc.Unsafe;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import static java.lang.System.getenv;
@ -1960,6 +1961,7 @@ public class Basic {
thread.start();
latch.await();
Thread.sleep(10);
String os = System.getProperty("os.name");
if (os.equalsIgnoreCase("Solaris") ||
@ -1984,6 +1986,15 @@ public class Basic {
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();