This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Remove sysctl-based implementation of thread::hardware_concurrency()
ClosedPublic

Authored by ldionne on Nov 25 2020, 1:55 PM.

Details

Summary

Using sysctl requires including headers that are considered internal on
Linux, like <sys/sysctl.h> & friends. Instead, sysconf is defined by POSIX
(and we have a fallback for Windows), so all the systems we support should
be happy with just sysconf.

Diff Detail

Event Timeline

ldionne created this revision.Nov 25 2020, 1:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 25 2020, 1:55 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
ldionne requested review of this revision.Nov 25 2020, 1:55 PM
MaskRay accepted this revision.Nov 25 2020, 1:59 PM
MaskRay added a subscriber: MaskRay.

I confirm that sysconf(_SC_NPROCESSORS_ONLN) works on musl. Thanks

ldionne accepted this revision.Nov 26 2020, 9:00 AM

I confirm that sysconf(_SC_NPROCESSORS_ONLN) works on musl. Thanks

Thanks!

This revision is now accepted and ready to land.Nov 26 2020, 9:00 AM