review request: 4244896: (process) Provide System.getPid(), System.killProcess(String pid)
Paul Sandoz
paul.sandoz at oracle.com
Fri May 11 15:51:15 UTC 2012
On May 11, 2012, at 5:24 PM, Rob McKenna wrote:
>
>>
>> For the following code:
>>
>> 227 long rem = end - now;
>> 228 while (!hasExited&& (rem> 0)) {
>> 229 wait(TimeUnit.NANOSECONDS.toMillis(rem));
>> 230 rem = end - System.nanoTime();
>> 231 }
>>
>> Can the above go into a spin loop once the duration is less than 1 millisecond for the rest of that duration? If so you may want to round it up to the nearest millisecond.
> Eesh. wait(0) will wait until notified so we could end up waiting past our timeout expiry. Would:
>
> wait(Math.max(TimeUnit.NANOSECONDS.toMillis(rem), 1));
>
> alleviate all concerns here?
>
Yes, or you could use:
wait(long timeout, int nanos)
Paul.
More information about the core-libs-dev
mailing list