googletest icon indicating copy to clipboard operation
googletest copied to clipboard

Default to GTEST_HAS_PTHREAD=1 for AIX, Solaris and z/OS

Open pgroke-dt opened this issue 3 years ago • 0 comments

Does the feature exist in the most recent commit?

No, see https://github.com/google/googletest/blob/main/googletest/include/gtest/internal/gtest-port.h#L534

Why do we need this feature?

It's possible to patch/replace gtest/internal/custom/gtest-port.h or build everything with -DGTEST_HAS_PTHREAD=1 to enable thread-support for additional platforms. But it would be easier & safer if threading was enabled by default on platforms that support it. We currently maintain a local patch to enable threading for AIX, Solaris and z/OS because we use GTest on those platforms with threaded code. We'd like to upstream this change if possible.

Describe the proposal

Change the default definition of GTEST_HAS_PTHREAD to include GTEST_OS_SOLARIS || GTEST_OS_AIX || GTEST_OS_ZOS.

Is the feature specific to an operating system, compiler, or build system version?

No. I suspect it's possible that ancient AIX, Solaris or z/OS versions didn't support POSIX threads, but I wouldn't know what the minimum version is. I propose to just extend the definition of GTEST_HAS_PTHREAD by GTEST_OS_SOLARIS || GTEST_OS_AIX || GTEST_OS_ZOS without any version checks - just like for the platforms that already default to "thread support on".

pgroke-dt avatar Aug 31 '22 12:08 pgroke-dt