library of assembled shared sources

http://lass.cocamware.com

lass::util::lock_free_stack< T, FixedAllocator > Class Template Reference

#include <lock_free_stack.h>

Inheritance diagram for lass::util::lock_free_stack< T, FixedAllocator >:

Inheritance graph
[legend]
Collaboration diagram for lass::util::lock_free_stack< T, FixedAllocator >:

Collaboration graph
[legend]

Data Structures

struct  node_t

Public Types

typedef T value_type

Public Member Functions

 lock_free_stack ()
 ~lock_free_stack ()
void push (const value_type &x)
 push value on stack.
bool pop (value_type &x)
 Try to pop a value and copy it in x .
bool pop_swap (value_type &x)
 Try to pop a value and swap it in x .

Private Types

typedef util::TaggedPtr< node_tpointer_t

Private Member Functions

 lock_free_stack (const lock_free_stack &)
lock_free_stackoperator= (const lock_free_stack &)
node_t *const make_node (const value_type &x)
void free_node (node_t *node)
void push_node (node_t *node)
node_t *const pop_node ()
void * allocate ()
void deallocate (void *iPointer)

Private Attributes

volatile pointer_t top_

Detailed Description

template<typename T, typename FixedAllocator = AllocatorFixed<AllocatorMalloc>>
class lass::util::lock_free_stack< T, FixedAllocator >

Definition at line 61 of file lock_free_stack.h.


Member Typedef Documentation

template<typename T , typename FixedAllocator = AllocatorFixed<AllocatorMalloc>>
typedef T lass::util::lock_free_stack< T, FixedAllocator >::value_type

Definition at line 65 of file lock_free_stack.h.

template<typename T , typename FixedAllocator = AllocatorFixed<AllocatorMalloc>>
typedef util::TaggedPtr<node_t> lass::util::lock_free_stack< T, FixedAllocator >::pointer_t [private]

Definition at line 82 of file lock_free_stack.h.


Constructor & Destructor Documentation

template<typename T , typename A >
lass::util::lock_free_stack< T, A >::lock_free_stack (  )  [inline]

Definition at line 51 of file lock_free_stack.inl.

template<typename T , typename A >
lass::util::lock_free_stack< T, A >::~lock_free_stack (  )  [inline]

template<typename T , typename FixedAllocator = AllocatorFixed<AllocatorMalloc>>
lass::util::lock_free_stack< T, FixedAllocator >::lock_free_stack ( const lock_free_stack< T, FixedAllocator > &   )  [private]


Member Function Documentation

template<typename T , typename A >
void lass::util::lock_free_stack< T, A >::push ( const value_type x  )  [inline]

push value on stack.

  • exception safe: if no node of could be allocatoed, or if copy constructor of x throws, it fails gracefully.

Definition at line 78 of file lock_free_stack.inl.

References lass::util::lock_free_stack< T, FixedAllocator >::make_node(), and lass::util::lock_free_stack< T, FixedAllocator >::push_node().

template<typename T , typename A >
bool lass::util::lock_free_stack< T, A >::pop ( value_type x  )  [inline]

Try to pop a value and copy it in x .

Returns:
false if stack is empty
  • strong exception safety: if copy-constructor of x throws, node is put back on top and exception is propagated

Definition at line 92 of file lock_free_stack.inl.

References lass::util::lock_free_stack< T, FixedAllocator >::free_node(), lass::util::lock_free_stack< T, FixedAllocator >::pop_node(), lass::util::lock_free_stack< T, FixedAllocator >::push_node(), and lass::util::lock_free_stack< T, FixedAllocator >::node_t::value.

template<typename T , typename A >
bool lass::util::lock_free_stack< T, A >::pop_swap ( value_type x  )  [inline]

Try to pop a value and swap it in x .

Returns:
false if stack is empty
  • condition on value_type: x.swap(y) must be a valid, non throwing operation.
  • exception safety: no-throw guarantee (if x.swap(y) plays by the rules)

Definition at line 121 of file lock_free_stack.inl.

References lass::util::lock_free_stack< T, FixedAllocator >::free_node(), lass::util::lock_free_stack< T, FixedAllocator >::pop_node(), and lass::util::lock_free_stack< T, FixedAllocator >::node_t::value.

template<typename T , typename FixedAllocator = AllocatorFixed<AllocatorMalloc>>
lock_free_stack& lass::util::lock_free_stack< T, FixedAllocator >::operator= ( const lock_free_stack< T, FixedAllocator > &   )  [private]

template<typename T , typename A >
lock_free_stack< T, A >::node_t *const lass::util::lock_free_stack< T, A >::make_node ( const value_type x  )  [inline, private]

template<typename T , typename A >
void lass::util::lock_free_stack< T, A >::free_node ( node_t node  )  [inline, private]

template<typename T , typename A >
void lass::util::lock_free_stack< T, A >::push_node ( node_t node  )  [inline, private]

template<typename T , typename A >
lock_free_stack< T, A >::node_t *const lass::util::lock_free_stack< T, A >::pop_node (  )  [inline, private]

template<typename FixedAllocator = AllocatorFixed<AllocatorMalloc>>
void* lass::util::AllocatorConcurrentFreeList< FixedAllocator >::allocate (  )  [inline, inherited]

template<typename FixedAllocator = AllocatorFixed<AllocatorMalloc>>
void lass::util::AllocatorConcurrentFreeList< FixedAllocator >::deallocate ( void *  iPointer  )  [inline, inherited]


Field Documentation

template<typename T , typename FixedAllocator = AllocatorFixed<AllocatorMalloc>>
volatile pointer_t lass::util::lock_free_stack< T, FixedAllocator >::top_ [private]


The documentation for this class was generated from the following files:

Generated on Mon Nov 10 14:22:16 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo