aTm
aTm

Reputation: 79

concurrent_unordered_map in c++

I have an algorithm that runs in serial, I am going to parallelise it. Now, this algorithm uses unordered_map in C++11. Can I substitute it with concurrent_unordered_map straight forward?

I want just to note that I have tried doing so but it seems to generate unintelligible errors. Like this one:

(.text._ZN3tbb13tbb_allocatorINS_10interface58internal18split_ordered_listISt4pairIKSsSt6vectorIjSaIjEEENS0_IS9_EEE4nodeEE8allocateEjPKv[tbb::tbb_allocator<tbb::interface5::internal::split_ordered_list<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<unsigned int, std::allocator<unsigned int> > >, tbb::tbb_allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::vector<unsigned int, std::allocator<unsigned int> > > > >::node>::allocate(unsigned int, void const*)]+0x16): undefined reference to `tbb::internal::allocate_via_handler_v3(unsigned int)'

Upvotes: 1

Views: 3085

Answers (1)

Rick
Rick

Reputation: 3353

concurrent_unordered_map allows concurrent inserts, and concurrent reads, but not concurrent deletes. so as long as you're not deleting while adding / iterating you should be fine.

  • the link issues mentioned above in the comments.

Upvotes: 2

Related Questions