Small improvements to nio native code (unix)

Martin Buchholz martinrb at google.com
Tue Aug 31 12:36:55 PDT 2010


On Tue, Aug 31, 2010 at 02:30, Alan Bateman <Alan.Bateman at oracle.com> wrote:

> Martin Buchholz wrote:
>
>> Hi Alan,
>>
>> I'd like you to do a code review.
>>
>> Avoid problematic JNI *Critical functions.
>> Fix rawtypes compile warnings.
>> Make IOUtil native code more readable.
>> Rename initPipe to makePipe.
>> Rename "block" argument to "blocking" for consistency.
>>
>> http://cr.openjdk.java.net/~martin/webrevs/openjdk7/IOUtil/<http://cr.openjdk.java.net/%7Emartin/webrevs/openjdk7/IOUtil/><
>> http://cr.openjdk.java.net/%7Emartin/webrevs/openjdk7/IOUtil/>
>>
>> Thanks,
>>
>> Martin
>>
> It makes sense to return the two file descriptors in a jlong rather than
> using a JNI critical section (although they aren't as bad as they used to be
> in that a thread requiring a GC because an allocation cannot be satisfied
> will now stall rather than throw OOME).
>
> Anyway, the changes look okay to me. I've created this bug:
>  6981145: (se) Eliminate JNI*Critical when creating pipes and other
> cleanups
>
> Minor nit but at line IOUtil.c L140 you've got "const char * msg" (space on
> either side of the asterisk).
>
>
Done, I've changed it to
char *msg
which seems to be winning the whitespace style popularity contest.


> In passing, I see in Java_sun_nio_ch_IOUtil_makePipe doesn't close the pipe
> in the highly unlikely event that the configureBlocking fails. It might be
> good to fix that while you are there (if you don't mind of course).
>
>
Done.

Webrev regenerated.

Martin


> -Alan.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20100831/f29ab1c3/attachment.html 


More information about the nio-dev mailing list