Container Query

Container Query


I need to share a container (likely a hash_map) between threads. The container will be searched fairly regularly, but entries will be inserted and removed only rarely.

I assume there is a lock associated with inserting/erasing (at least around the particular item). Are there any locks associated with searching or iterating through a hash_map, assuming a const_iterator is used?

Many thanks.


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

Unless I overlooked something, you have to choose between searching, inserting and iterating (concurrent_unordered_map) or searching, inserting and removing (concurrent_hash_map). The former has no visible locks, the latter has locks in the form of accessors.

Leave a Comment

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