Question about tbb::concurrent_unordered_map

Question about tbb::concurrent_unordered_map

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?



2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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)

Leave a Comment

Please sign in to add a comment. Not a member? Join today