C++11 std::threads vs posix threads

后端 未结 4 1999
广开言路
广开言路 2020-12-02 04:05

Why should I prefer one or another in practice? What are technical differences except that std::thread is a class?

4条回答
  •  失恋的感觉
    2020-12-02 04:37

    std::thread provides portability across different platforms like Windows, MacOS, and Linux.

    As mentioned by @hirshhornsalz in the comments below and related answer https://stackoverflow.com/a/13135425/1158895, std::thread may not be complete on all platforms yet. Even still, (it will be in the near future) it should be favored over pthread's because it should make your application more future-proof.

提交回复
热议问题