Is concurrent_unordered_map safe if insert and erase at the same time?

Is concurrent_unordered_map safe if insert and erase at the same time?

Something confuse me when i use tbb::concurrent_unordered_map, but can I erase the item while updating the other one or inserting a new one? What is unsafe_erase exactly mean?

2 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

The Reference Manual is pretty clear on that: "The erase methods are prefixed with unsafe_, to indicate that they are not concurrency safe."

Only use such methods while no other threads are accessing the container (the exclusion is per instance even if the documentation does not explicitly say so), or consider using concurrent_hash_map instead.

登陆并发表评论。