[cpp-threads] N2800's C/C++MM and read-write locking

Peter Dimov pdimov at mmltd.net
Thu Jan 8 14:01:28 GMT 2009


>> I also often tend to think of "rwlocks" as shared/exclusive locks.  If 
>> you really
>> want to use weaker fences for readers, I think you would need to split 
>> them
>> into two variantes: shared/exclusive and read/write.
>
> Care to elaborate?

Something like:

take shared lock
try STM transaction in a lock-free manner
unlock

if failed
    take write lock
    use ordinary ops
    unlock

Here the lock is not used as a pure read lock since the transaction contains 
writes. 




More information about the cpp-threads mailing list