Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-10-15 10:03:55


A preliminary documentation for a concurrent_hash_map is available:

http://www.pdimov.com/cpp/concurrent_hash_map.html

There exists a prototype implementation for that :-) and I'll post it online
after a bit of cleanup.

I have a question on the interface that hopefully may be of interest to
someone. concurrent_hash_map implements the following member function:

template<class F> bool find_and_visit( K const & k, F f );

that looks up the element with a key k in the map and, if found, invokes f
on its associated value. This can be useful in a number of situations, but
it poses the following problem: what if two threads call find_and_visit at
the same time with the same k and f modifies its argument? Should the map
serialize the two calls to f, or should it leave the responsibility of
ensuring proper synchronization (or atomic update, if the mapped_type allows
it) to the user?

Thanks in advance for any comments/opinions on the interface.

--
Peter Dimov
http://www.pdimov.com 

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk