- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page