Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2412 Discussions

Question about tbb::concurrent_unordered_map

jczhang_bj
Beginner
158 Views

The document says "A concurrent_unordered_map supports concurrent insertion and traversal, but not concurrent erasure."

What is the meaning of concurrent erasure? In my application, multiple threads concurrently insert items in a map, but only ONE thread may erase items. Concurrent insertion and erasure use different keys.

Is it safe to use concurrent_unordered_map?

Thanks

--Junchao

0 Kudos
1 Reply
Anton_M_Intel
Employee
158 Views
concurrency of erasure means it is concurrent to other operations (inserts). No, it is not safe. Please look at tbb::concurrent_hash_map instead (but it has no safe traversal)
Reply