[concurrency-interest] Timestamps-based ConcurrentMap

David Holmes dcholmes at optusnet.com.au
Sat Mar 11 04:54:58 EST 2006


Jean Morissette writes:
> Sorry, I made a mistake in my first post. In fact, iterators *don't*
> need to be shared amongst threads. However, they need to reflect the
> state of the map at the creation of the iterator, independently of the
> map update operations.

That is still an interesting requirement if the map is in use when the
iterator is created, as there are potential races adding or removing
elements.

As there is no way to make an atomic snapshot then you will have to have
some way of telling when each entry was added and removed from the map. Your
timestamps seem the only option - albeit a complicated one. It would be a
fair bit simpler if you didn't need to worry about elements that are removed
after the iterator is created. :)

Good luck.

David Holmes



More information about the Concurrency-interest mailing list