Request for review (M): 7132070: Use a mach_port_t as the OSThread thread_id rather than pthread_t on BSD/OSX

Staffan Larsen staffan.larsen at oracle.com
Wed Feb 15 10:52:19 PST 2012


On 15 feb 2012, at 12:52, David Holmes wrote:

> Hi Staffan,
> 
> Not directly related to the change but what does  _ALLBSD_SOURCE signify?

What Dan said (I wasn't sure myself).

> In os_bsd.cpp:
> 
> In os::thread_cpu_time the type of mach_thread has changed from mach_port_t to thread_t, but mach_thread is still passed into thread_info(). I expect they are both simple integral types, but I would expect that later gcc compilers might complain about this. What type does thread_info expect?

thread_info() expects a thread_t, but thread_t and mach_port_t are actually the same thing (typdef:ed).

> 
> Otherwise seems ok.

Thanks,
/Staffan


> 
> David
> 
> 
> On 15/02/2012 8:29 PM, Staffan Larsen wrote:
>> Please review the following change:
>> 
>> Bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7132070
>> 
>> Webrev: http://cr.openjdk.java.net/~sla/7132070/webrev.00/
>> 
>> This changes the value returned by OSThread::thread_id() and
>> os::current_thread_id() on macosx to return the mach thread_t instead of
>> pthread_t. There is a separate method OSThread:pthread_id() that returns
>> the pthread_t.
>> 
>> The reason for this change is both that JFR would like a 4 byte value
>> for thread id, and that SA requires access to the thread_t.
>> 
>> Thanks,
>> /Staffan



More information about the serviceability-dev mailing list