问题描述
有没有任何ConcurrentHashMap for c ++实现或类似的东西?
Is there any ConcurrentHashMap for c++ implementation or something of similar anywhere?
我不明白为什么c ++中的多线程比Java更难。
I can't understand why multithreading in c++ is so hard than Java!
推荐答案
线程并不真正支持C ++,所以在标准中没有任何关于线程安全容器。
Threads arent really supported in C++ so there isnt anything in the standard about thread safe containers. People have obviously made them before.
我认为Intel的这个东西可能会帮助
I think this thing from Intel may help http://www.threadingbuildingblocks.org/
我还没有使用它,所以没有担保人。
I have not used it myself yet so no guarentees.
您也可以在自己的类中使用信号量将任何容器包装成线程安全。
You can also just wrap any container in your own class with a semaphore to make it thread safe.
祝你好运。
这篇关于ConcurrentHashMap for c ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!