ConcurrentHashMap for c++

后端 未结 3 1271
清歌不尽
清歌不尽 2020-12-19 01:04

Is there any ConcurrentHashMap for c++ implementation or something of similar anywhere?

I can\'t understand why multithreading in c++ is so hard than Java!

相关标签:
3条回答
  • 2020-12-19 01:26

    There is tbb::concurrent_hash_map and tbb::concurrent_unordered_map of Intel TBB

    0 讨论(0)
  • 2020-12-19 01:33

    There is a new open-source library called junction available that contains several new concurrent maps.

    https://github.com/preshing/junction

    It’s BSD-licensed, so you can use the source code freely in any project, for any purpose.

    Find more detail in this blogpost.

    Thanks to the author Jeff.

    0 讨论(0)
  • 2020-12-19 01:36

    Threads arent really supported in C++ so there isnt anything in the standard about thread safe containers. People have obviously made them before.

    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.

    Good luck.

    0 讨论(0)
提交回复
热议问题