3

Make `std::thread::available_concurrency` support process-limited number of CPUs...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/89310
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Member

joshtriplett commented on Sep 27

edited

Use libc::sched_getaffinity and count the number of CPUs in the returned mask. This handles cases where the process doesn't have access to all CPUs, such as when limited via taskset or similar.

This also covers cgroup cpusets.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK