
"Chris Thomasson" <cristom@comcast.net> wrote in message news:ehgjr6$iru$1@sea.gmane.org...
"Peter Dimov" <pdimov@mmltd.net> wrote in message news:00e901c6f613$06ed8a00$6607a8c0@pdimov2...
Chris Thomasson wrote:
[...]
Are you referring to the case in which a collection was not protected by a mutex? If so, I was basically referring to some sort of lock-free, or mostly lock-free collection. You can use ptr::global in a lock-free collection, it isn't very practical because of the spinlock, but it is compatible. Its was just a simple example to show some of the algorithms flexibility...
To clarify, you can use ptr::global in the anchor structure of a lock-free collection. For example: template<typename T_state> struct node { ptr::global<node> m_next; T_state *m_state; }; // packed structure template<typename T_node> struct lflifo_anchor { ptr::global<T_node> m_node; uintword_t m_aba; }; typedef lflifo_anchor<node<foo> > my_anchor_foo_t; my_anchor_foo_t can be modified with DWCAS, because (sizeof(my_anchor_foo_t) == (sizeof(void*) * 2)).