amino::LockFreeStack< T > Class Template Reference

This is a lock-free stack, based on: IBM, IBM System/370 Extended Architecture, Principles of Operation, 1983 ABA prevention method is based on Maged M. Michael's: Hazard Pointers: Safe Memory Reclamation for Lock-Free Objects. More...

#include <stack.h>

List of all members.

Public Member Functions

 LockFreeStack ()
 constructor
 ~LockFreeStack ()
 destructor
bool pop (T &ret)
 Pop data from the Stack.
void push (const T d)
 Push data onto Stack.
bool empty ()
 Check to see if Stack is empty.
int size ()
 Get the size of stack.
bool peekTop (T &ret)
 Get the topmost element in the stack. If the stack is empty, it will return false. else return true and assign the topmost element to the parameter.

Classes

class  StackNode
 The node type, which stores the data and a next pointer in it. More...


Detailed Description

template<typename T>
class amino::LockFreeStack< T >

This is a lock-free stack, based on: IBM, IBM System/370 Extended Architecture, Principles of Operation, 1983 ABA prevention method is based on Maged M. Michael's: Hazard Pointers: Safe Memory Reclamation for Lock-Free Objects.

Author:
Mo Jiong Qiu
Template Parameters:
T Type of element stored in it

Constructor & Destructor Documentation

template<typename T>
amino::LockFreeStack< T >::LockFreeStack (  )  [inline]

constructor

template<typename T>
amino::LockFreeStack< T >::~LockFreeStack (  )  [inline]

destructor


Member Function Documentation

template<typename T>
bool amino::LockFreeStack< T >::pop ( T &  ret  )  [inline]

Pop data from the Stack.

Parameters:
ret topmost element of the stack. It is valid if the return value is true.
Returns:
If the value exists in the list, remove it and return true. else return false.

template<typename T>
void amino::LockFreeStack< T >::push ( const T  d  )  [inline]

Push data onto Stack.

Parameters:
d data to be pushed into the stack.

template<typename T>
bool amino::LockFreeStack< T >::empty (  )  [inline]

Check to see if Stack is empty.

Returns:
true if stack is empty.

template<typename T>
int amino::LockFreeStack< T >::size (  )  [inline]

Get the size of stack.

Returns:
The size of stack

template<typename T>
bool amino::LockFreeStack< T >::peekTop ( T &  ret  )  [inline]

Get the topmost element in the stack. If the stack is empty, it will return false. else return true and assign the topmost element to the parameter.

Parameters:
ret The topmost element in the stack. It is valid if the return value is true.
Returns:
If the stack is empty return false, else return true.


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

Generated on Tue Dec 9 13:39:39 2008 for Amino by  doxygen 1.5.6