Community
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_b
Beginner
44 Views

Container Query

Hiya,

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.

Jim
0 Kudos
1 Reply
RafSchietekat
Black Belt
44 Views

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.
Reply