-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sysinfo.cc: Always abort on GetNumCPUs failure #1756
Conversation
src/sysinfo.cc
Outdated
if (GetSysctl("hw.ncpu", &num_cpu)) return num_cpu; | ||
fprintf(stderr, "Err: %s\n", strerror(errno)); | ||
std::exit(EXIT_FAILURE); | ||
if (GetSysctl("hw.ncpu", &num_cpu)) return CheckNumCPUs(num_cpu); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stale?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry!
Defines a wrapper function, CheckNumCPUs, which enforces that GetNumCPUs never returns fewer than one CPU. There is no reasonable way to continue if we are unable to identify the number of CPUs. Signed-off-by: Sam James <sam@gentoo.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thank you!
@thesamesam thank you! |
Many thanks! |
Accepted upstream already. See: google/benchmark#1753 See: google/benchmark#1756 Bug: https://bugs.gentoo.org/922877 Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk>
Accepted upstream already. See: google/benchmark#1753 See: google/benchmark#1756 Bug: https://bugs.gentoo.org/922877 Signed-off-by: Matoro Mahri <matoro_gentoo@matoro.tk> Closes: #35729 Signed-off-by: Sam James <sam@gentoo.org>
Defines a wrapper function, CheckNumCPUs, which enforces that GetNumCPUs never returns fewer than one CPU. There is no reasonable way to continue if we are unable to identify the number of CPUs.
This is a followup to #1753.