On Wed, 17 Mar 2021 14:16:36 GMT, Roger Riggs <[email protected]> wrote:
> Intermittent failures on Windows in a test of destroying the child warrant
> extending the time the parent waits after starting the child before
> destroying the child.
test/jdk/java/lang/ProcessBuilder/Basic.java line 2183:
> 2181: latch.await();
> 2182: Thread.sleep(100L); // Wait for child
> initialization to settle
> 2183:
Hi Roger,
Shouldn't the code that follows this sleep already be enough to wait for child
thread to get a lock on the stream?
Thread.sleep(100L); // Wait for child initialization to
settle
if (s instanceof BufferedInputStream) {
// Wait until after the s.read occurs in "thread" by
// checking when the input stream monitor is acquired
// (BufferedInputStream.read is synchronized)
while (!isLocked(s, 10)) {
Thread.sleep(100);
}
}
>From 1st glance I would conclude that the 1st sleep is unnecessary. Is there a
>platform where Input/Error stream is not a BufferedInputStream?
-------------
PR: https://git.openjdk.java.net/jdk/pull/3049