Can I access a C++11 std::map entry while inserting/erasing from another thread?

前端 未结 4 1152
半阙折子戏
半阙折子戏 2021-01-12 15:16

Can I access (without locking) an std::map entry while another thread inserts/erases entrys?

example pseudo C++:

typedef struct {
   int value;
   in         


        
4条回答
  •  天命终不由人
    2021-01-12 16:00

    No. std::map are not thread safe. Intel's thread building block (tbb) library has some concurrent containers. Check tbb

提交回复
热议问题