What is the closest to ConcurrentHashMap and NavigableMap in Java?

ilya-stromberg ilya-stromberg-2009 at yandex.ru
Fri Nov 15 09:03:14 PST 2013


On Friday, 15 November 2013 at 16:36:56 UTC, Jacek Furmankiewicz 
wrote:
> How can you achieve lock-free reads with the synchronized MyMap 
> approach?

In this case you can use Readers-writer lock
http://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock

It allows multiple reads and single write. I think that the 
easiest way is use OS spesific function, for example 
`pthread_rwlock_t` for POSX. Note that D supports C ABI, so you 
can call any C function from D.

I don't know any D implementation of Readers-writer lock, but you 
can ask this question - maybe it already exist.


More information about the Digitalmars-d-learn mailing list