Skip to content

Include Haiku in processor count checks #3326

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

Merged
merged 1 commit into from
Jul 28, 2021

Conversation

wattoc
Copy link
Contributor

@wattoc wattoc commented Jul 27, 2021

Haiku should be performing processor count checks and using them to limit thread creation as the other OS's do.

This is currently being patched in on HaikuPorts against 0.3.17: haikuports/haikuports#6094

@brada4
Copy link
Contributor

brada4 commented Jul 27, 2021

Is this correct CPU number detection?

#ifdef OS_HAIKU
int get_num_procs(void) {
  static int nums = 0;
  if (!nums) nums = sysconf(_SC_NPROCESSORS_CONF);
  return nums;
}
#endif

@wattoc
Copy link
Contributor Author

wattoc commented Jul 28, 2021

Yes, Haiku supports this call and it is used by other apps to count CPUs:

https://github.com/haiku/haiku/search?q=_SC_NPROCESSORS_CONF

@martin-frbg martin-frbg added this to the 0.3.18 milestone Jul 28, 2021
@martin-frbg martin-frbg merged commit f681553 into OpenMathLib:develop Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants