简体   繁体   English

标准是std :: thread的标准?

[英]How standard is std::thread?

I've noticed that on a lot of the classic C++ reference sources that HAVE been updated for C++11, such as cplusplus.com and the Josuttis Standard Library Reference book, don't seem to cover / have any documentation at all on the C++11 concurrency standard library features, such as std::thread , std::atomic , and std::async . 我注意到很多已经为C ++ 11更新过的经典C ++参考资料源,例如cplusplus.comJosuttis标准库参考书 ,似乎根本没有涵盖/有任何文档。 C ++ 11并发标准库的功能,例如std::threadstd::atomicstd::async

Are these concurrency features somehow "less standard" than the rest of the standard library? 这些并发功能是否比标准库的其他部分“更不标准”? Or is the documentation just lacking for some other reason? 或者文档是否缺乏其他原因?

All of the libraries you've referenced are indeed a part of the C++11 standard. 您引用的所有库都确实是C ++ 11标准的一部分。 In fact, a lot of the language rules were reworked to describe how operations work in a multithreaded environment (previously, the spec didn't specify any semantics for how threads would work). 实际上,许多语言规则被重新设计来描述操作在多线程环境中的工作方式(以前,规范没有指定线程如何工作的任何语义)。

I can't say why the documentation is lacking on those sites, since I don't know who runs them, but threads, atomics, etc. are definitely a part of C++11. 我不能说为什么这些网站上缺少文档,因为我不知道是谁运行它们,但线程,原子等绝对是C ++ 11的一部分。

On a related note, I would strongly suggest not using cplusplus.com as a reference. 在相关的说明中,我强烈建议不要使用cplusplus.com作为参考。 It's known to have had some inaccuracies in the past, and other sites (namely, cppreference.com) are a lot more complete and accurate. 众所周知,过去有一些不准确之处,其他网站(即cppreference.com)更加完整和准确。

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM