[cpp-threads] atomic operations package

jimmaureenrogers at att.net jimmaureenrogers at att.net
Fri Oct 14 01:46:42 BST 2005


 -------------- Original message ----------------------
From: "Peter Dimov" <pdimov at mmltd.net>
> Alexander Terekhov wrote:
> > On 10/9/05, Peter Dimov <pdimov at mmltd.net> wrote:
> 
> >> Consider a mostly lock-free data structure where most operations
> >> (insert, delete, find) can proceed in parallel, but some (resize)
> >> need exclusive lock. It's natural to use a rwlock for that; a rwlock
> >> is not about reads or writes, it's about shared and exclusive access.
> >
> > ...I don't get it.
> 
> You may be right. It seems that even for this case the read/write mutex does 
> not need to constrain writes on rdlock. I can post a snapshot of my 
> concurrent_hash_map implementation if you're interested. 
> 

I do not see it. What happens when thread A is deleting an item while thread B
is doing a find operation on that item? It appears to me that those are two
incompatible concurrent operations. If the find reads a value during a delete
operation the find operation may return an invalid or corrupted result.

------
Jim Rogers
Colorado Springs, Colorado
U.S.A.




More information about the cpp-threads mailing list