Boost logo

Boost :

From: Chris Thomasson (cristom_at_[hidden])
Date: 2006-10-22 16:55:45

"Chris Thomasson" <cristom_at_[hidden]> wrote in message
> "Peter Dimov" <pdimov_at_[hidden]> wrote in message
> news:00e901c6f613$06ed8a00$6607a8c0_at_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)).

Boost list run by bdawes at, gregod at, cpdaniel at, john at