Why is there a difference using std::thread::hardware_concurrency() and boost::thread::hardware_concurrency()?

前端 未结 2 1929
孤街浪徒
孤街浪徒 2021-02-12 09:39

The description of the problem itself is pretty simple. I\'m testing the differences of std::thread library in C++11 and boost::thread library.

The output of these:

2条回答
  •  说谎
    说谎 (楼主)
    2021-02-12 09:49

    After reviewing /usr/include/c++/4.6.2/thread

    it can be seen that the implementation is actually:

    // Returns a value that hints at the number of hardware thread contexts.
    static unsigned int
    hardware_concurrency()
    { return 0; }
    

    So problem solved. It's just another feature that hasn't been implemented in gcc 4.6.2

提交回复
热议问题