std::jthrea...concurrency(3)
π NAME π
okay bestie, welcome to the std::jthrea...concurrency(3) page from the C++ Standard Libary (yes, that's the spelling in the header, we're keeping it π
). This page is literally named std::jthread::hardware_concurrency - std::jthread::hardware_concurrency, and she's here to tell you how many concurrent threads your implementation says it can support. Iconic. β¨
π¦ Synopsis π¦
[[nodiscard]] static unsigned int hardware_concurrency() noexcept;
(since C++20) πΈ
She returns the number of concurrent threads supported by the implementation. Important vibe check: the value should be considered only a hint β not a promise, not a contract, just a hint, bestie. π«Ά
πΈ Parameters πΈ
(none) β literally no parameters. Not a single one. Nada. π
π Return value π
Number of concurrent threads supported. If the value is not well defined or not computable, she returns 0. That's the whole deal. β¨
π₯ Example π₯
// Run this code β go off, run it:
#include <iostream>
#include <thread>
int main()
{
unsigned int n = std::jthread::hardware_concurrency();
std::cout << n << " concurrent threads are supported.\n";
}
π Possible output π
4 concurrent threads are supported.
π See also π
hardware_destructive_interference_sizeβ min offset to avoid false sharinghardware_constructive_interference_sizeβ max offset to promote true sharing(C++17)β(constant)
okay that's the page, bestie π sourced from http://cppreference.com, version/date 2024.06.10, manual std::jthrea...concurrency(3). periodt. π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms