Reputation: 445
(This is probably a really easy one - I am terrible at searching C++ proposals and I cannot seem to find the relevant one.)
std::thread::hardware_concurrency
returns a hint at the number of hardware-supported concurrent thread executions.
But what good is that? I would consider the actually available number of hardware threads the important information, and for that hardware_concurrency
is but an upper bound. (YMMV, but myself I would deem even a lower bound to be more useful.)
Without a sensible use case, the function would presumably have been rejected, so some must exist.
A recent proposal, Usability improvements for std::thread, mentions the function in passing without taking issue with its usefulness or lack thereof. It is also telling that since C++11 the function has not been changed or extended in any way or form.
What are the envisioned use cases for std::thread::hardware_concurrency
as (presumably)* discussed during the C++ standardisation process?
* - Should it be so, a valid answer would of course also be: "WG21 dropped the ball on this one: There is no use case, yet the function has not been rejected". I would also consider articles or blog posts by WG21 members or the proposal authors sufficiently authorative to stand-in for an actual proposal.
I tried to find the motivating proposal and found N2184 but that one only mentions that the function exist and what it do, but does not leave a word towards what to do with it. The slightly earlier N2178 does not mention the function at all, so N2184 must be close to its origin, yet I cannot find anything relevant in the vicinity.
A good answer would additionally hint at how to effectively maneuver through the standard proposals - struggling with finding the original / the motivating / the definitive proposal for any one feature is why I am asking this question to begin with and have asked similar questions in the past.
(Some of the proposal authors link to preceeding proposals, but most do not.)
Upvotes: -4
Views: 82