且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

linux 和 gcc 4 中的 C++ 新运算符线程安全

更新时间:2023-11-12 17:48:52

您将不得不寻找一个支持线程但没有线程安全的平台new.事实上,new(和malloc)的线程安全性是它如此缓慢的原因之一.

You will have to look very hard to find a platform that supports threads but doesn't have a thread safe new. In fact, the thread safety of new (and malloc) is one of the reasons it's so slow.

另一方面,如果您想要一个线程安全的 STL,您可以考虑 Intel TBB,它具有线程感知能力容器(尽管并非对它们的所有操作都是线程安全的).

If you want a thread safe STL on the other hand, you may consider Intel TBB which has thread aware containers (although not all operations on them are thread safe).