This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Allow explicit pthread opt-in
ClosedPublic

Authored by bcraig on May 24 2016, 9:54 AM.

Details

Summary

The existing pthread detection code in __config is pretty good for common operating systems. It doesn't allow cmake-time choices to be made for uncommon operating systems though.

This change adds the LIBCXX_HAS_PTHREAD_API cmake flag, which turns into the _LIBCPP_HAS_THREAD_API_PTHREAD preprocessor define. This is a name change from the old _LIBCPP_THREAD_API_PTHREAD. The lit tests want __config_site.in variables to have a _LIBCPP_HAS prefix.

Diff Detail

Event Timeline

bcraig updated this revision to Diff 58255.May 24 2016, 9:54 AM
bcraig retitled this revision from to [libcxx] Allow explicit pthread opt-in.
bcraig updated this object.
bcraig added reviewers: rmaprath, mclow.lists, EricWF.
bcraig added a subscriber: cfe-commits.
rmaprath edited edge metadata.May 24 2016, 11:24 AM

Couple of minor comments. LGTM otherwise.

/ Asiri

CMakeLists.txt
387

I think we should put in a check to make sure that LIBCXX_HAS_PTHREAD_API is only enabled when LIBCXX_ENABLE_THREADS is also enabled.

include/__config
816

Similarly here. For example, there is a similar check for _LIBCPP_HAS_NO_MONOTONIC_CLOCK compatibility with the LIBCXX_ENABLE_THREADS flag.

bcraig updated this revision to Diff 58320.May 24 2016, 2:34 PM
bcraig edited edge metadata.
bcraig marked 2 inline comments as done.
rmaprath accepted this revision.May 24 2016, 11:06 PM
rmaprath edited edge metadata.

LGTM.

(I don't have powers to accept libcxx patches in general, but this patch is quite small and related to something I plugged in, so, I think it's OK in this instance)

This revision is now accepted and ready to land.May 24 2016, 11:06 PM
bcraig closed this revision.May 25 2016, 11:14 AM