- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am wondering whether I can access concurrent_hash_map in the non-blocking fashion.
If I understand correctly,
bool find( accessor& result, const Key& key )
would acquire the write lock, and other threads trying to acquire the write lock for the same key would wait until
the write lock is released, right?
Is it possible for me to just 'try' the write lock? That is, a thread will try to acquire the write lock,
but if the entry is already write-locked then I would like to make it move on rather than being blocked
until the write lock gets released.
Thanks in advance,
Hyokun Yun
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apparently not, but why would you want that? Threads are supposed to hold a write lock only as shortly as possible. Consider doing something with const_accessor instead (the documentation appears to be negligent about specifying whether multiple threads can concurrently hold a const_accessor to the same element?), concurrent_unordered_map, ...

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page