Suggestion about including pthread.h
Shi Jun Zhang
zhangshj at linux.vnet.ibm.com
Fri Mar 2 08:19:12 UTC 2012
On 3/2/2012 3:53 PM, David Holmes wrote:
> On 2/03/2012 5:05 PM, Shi Jun Zhang wrote:
>> Currently jdk/src/solaris/bin/java_md.c includes <pthread.h> with
>> "#ifdef __linux__", but BSD, MAC OS, AIX all needs to include pthread.h.
>> To avoid the situation that the ifdef clause becomes longer and longer
>> like "#if defined(__linux__) || defined(_ALLBSD_SOURCE) || defined(AIX)
>> || defined(OTHER_PLATFORMS)", i suggest to use USE_PTHREADS already
>> defined in jdk/make/common/Defs-linux.gmk and add a compiler flag if
>> USE_PTHREADS is true. It will look like this:
>> ifeq ($(USE_PTHREADS), true)
>> CPPFLAGS_COMMON += -DUSE_PTHREADS
>> endif
>>
>> And then all the places need to include pthread.h only needs to use
>> "#ifdef USE_PTHREADS". The files include pthread.h are
>> jdk/src/solaris/bin/java_md.c
>> jdk/src/solaris/native/sun/nio/ch/NativeThread.c
>> jdk/src/solaris/transport/socket/socket_md.c
>>
>> Any comments?
>
> Yes we need to move to a more capability based inclusion & conditional
> compilation mechanism. I'm not sure if the build-infra project is
> tackling this particular case.
>
> David
>
So add build-infra in the loop.
--
Regards,
Shi Jun Zhang
More information about the core-libs-dev
mailing list