提交 51c31e33 编写于 作者: R robm

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

Reviewed-by: alanb, martin
上级 a4aa4447
......@@ -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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册