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

Martin Buchholz martinrb at google.com
Fri Oct 12 16:17:57 UTC 2012


On Fri, Oct 12, 2012 at 7:32 AM, Rob McKenna <rob.mckenna at oracle.com> wrote:

> Hi folks,
>
> Managed to remove the Thread.sleep(10) from the test when fixing 7152183.
> Sorry about that.
>
>
I thought you had done that intentionally, and so "if it passes, then OK".

The way the code's been written, it should now be robustly race-free on
Solaris.  Do you actually see racy failures on other OSes?

Perhaps do the sleep conditionally, only in the non-Solaris case?

In the Linux case, the reading thread will eventually acquire the monitor
lock on the input stream.  It might work to wait for that using the hacky
but non-racy:

if (stream instanceof BufferedInputStream) {
...

while (Unsafe.tryMonitorEnter(stream)) {
  Unsafe.MonitorExit(stream);
  Thread.sleep(1);
}

http://cr.openjdk.java.net/~**robm/8000817/webrev.01/<http://cr.openjdk.java.net/~robm/8000817/webrev.01/><
> http://cr.openjdk.java.net/%**7Erobm/8000817/webrev.01/<http://cr.openjdk.java.net/%7Erobm/8000817/webrev.01/>
> >
>
>     -Rob
>
>



More information about the core-libs-dev mailing list