atomic operations for shared_ptr ?

Bronek Kozicki brok@spamcop.net
Sat Aug 24 19:45:00 GMT 2013


On 24/08/2013 20:34, Bronek Kozicki wrote:
>
> Perhaps spinlock could be implemented without breaking ABI? Please check
> performance comparison figures at the end of this document:
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2632.html
>
> Here they suggest use "a spinlock pool keyed on a hash of the address of
> the instance", although perhaps a special value of _M_ptr might be used
> instead (that value being the address of _M_ptr itself).
>
> Alternatively, a single bit might be sacrificed in existing data members
> although that would most likely impose performance penalty on most
> common uses, so I'm not really advocating it.

Scratch the part starting with "although perhaps a special value of 
_M_ptr", it just occured to me it will have exactly same performance 
effect on common uses as taking a single bit from existing data members 
(i.e. not good).


B.



More information about the Libstdc++ mailing list