RFR: 8087322: Implement a Semaphore utility class

Kim Barrett kim.barrett at oracle.com
Wed Jun 24 22:46:55 UTC 2015


On Jun 24, 2015, at 6:39 PM, David Holmes <david.holmes at oracle.com> wrote:
> 
>> 1) The comment above vmassert_status says:
>> 
>> // This version of vmassert is for use with checking return status from
>> // library calls that return actual error values eg. EINVAL,
>> // ENOMEM etc, rather than returning -1 and setting errno.
>> // When the status is not what is expected it is very useful to know
>> // what status was actually returned, so we pass the status variable as
>> // an extra arg and use strerror to convert it to a meaningful string
>> // like "Invalid argument", "out of memory" etc
>> 
>> 
>> but called library calls actually do return -1 and sets errno. Maybe the
>> comment is too specific?
> 
> No the comment is as I intended when I wrote it :) This was for those POSIX library calls that don't set errno and return -1, but which return an error code directly: eg the pthread_* family of functions for POSIX
> 
> Where did you see another form of library call using it? It is possible some misuse has crept in.

Oh, good, we actually have original intent available.

Would you consider it a misuse to do

    assert_status(ret == 0, errno, <msg>);



More information about the hotspot-dev mailing list