Files
Nim/lib/pure
lit e0e698be9a impr: std/cpuinfo: use documented impl ; support JS (#23911)
Currently `cpuinfo.countProcessor` uses hard-coded `HW_AVAILCPU=25` for
both MacOS and BSD;

However,

[There is no HW_AVAILCPU on FreeBSD, NetBSD, and OpenBSD](
https://bugs.webkit.org/show_bug.cgi?id=132542)

Also, `HW_AVAILCPU` is undocmented in MacOS,
while `sysctlbyname("hw.logicalcpu",...)` is documented and used
by many other languages' implementations, like
[Haskell](https://gitlab.haskell.org/ghc/ghc/-/blob/master/rts/posix/OSThreads.c?ref_type=heads#L376)

---

This PR:

- use `importc` value instead of hard-coded values for `HW_*` macros.
- use "hw.logicialcpu" over undocumented HW_AVAILCPU.
- reduce 2 elements of `mib` array when calling `sysctl` as they're no
use.
2024-08-11 17:32:58 +02:00
..
2015-10-01 12:05:45 -07:00
2024-05-16 23:22:49 +02:00
2024-07-26 20:45:52 +02:00
2021-01-09 00:24:41 +01:00
2024-07-26 20:45:52 +02:00
2022-12-03 21:25:49 +08:00
2023-12-18 13:25:49 +08:00
2023-12-15 07:48:34 +01:00
2023-03-20 18:51:58 +01:00
2021-02-08 09:46:07 +01:00