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

Container Query

jim_b
Beginner
100 Views
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
100 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