OgreHaptics::ConcurrentQueue< T >::HazardPtr Class Reference

HazardPtr provides a safe mechanism for threads to advertise to all other threads making use of the same data structure about their memory usage. More...

#include <OgreHapticsConcurrentQueue.h>

Inheritance diagram for OgreHaptics::ConcurrentQueue< T >::HazardPtr:

OgreHaptics::NonCopyable

List of all members.

Public Member Functions

 HazardPtr ()
 Standard constructor.
virtual ~HazardPtr ()
 Virtual destructor.

Protected Attributes

int active
 Is the hazard pointer still active, ie.
HazardPtrnext
 Pointer to the next hazard pointer used in the single linked list.
Node * hazards [2]
 Array of pointers to Nodes which are marked as hazardous.
NodeList retiredList
 List of by the owner thread retired nodes, marked for reclaimation.

Friends

class ConcurrentQueue


Detailed Description

template<typename T>
class OgreHaptics::ConcurrentQueue< T >::HazardPtr

HazardPtr provides a safe mechanism for threads to advertise to all other threads making use of the same data structure about their memory usage.

Remarks:
Each thread making use of an instance of the ConcurrentQueue must allocate and own a hazard pointer for that instance and must retire the hazard pointer when the thread does not wish to make use of the queue anymore, in order to mark the hazard pointer for reuse by other threads and to reclaim memory which has not yet been identified as eligible for reuse.
Do not instantiate or destroy an instance yourself. Instead use ConcurrentQueue::allocateHazardPtr and ConcurrentQueue::retireHazardPtr respectively.

Definition at line 107 of file OgreHapticsConcurrentQueue.h.


Constructor & Destructor Documentation

template<typename T>
OgreHaptics::ConcurrentQueue< T >::HazardPtr::HazardPtr (  ) 

Standard constructor.

Definition at line 113 of file OgreHapticsConcurrentQueue.h.

References OgreHaptics::ConcurrentQueue< T >::HazardPtr::hazards.

template<typename T>
virtual OgreHaptics::ConcurrentQueue< T >::HazardPtr::~HazardPtr (  )  [virtual]

Virtual destructor.

Definition at line 121 of file OgreHapticsConcurrentQueue.h.


Friends And Related Function Documentation

template<typename T>
friend class ConcurrentQueue [friend]

Definition at line 110 of file OgreHapticsConcurrentQueue.h.


Member Data Documentation

template<typename T>
int OgreHaptics::ConcurrentQueue< T >::HazardPtr::active [protected]

Is the hazard pointer still active, ie.

can it be used again? A 32-bit integer is needed for compare-and-swap.

Definition at line 125 of file OgreHapticsConcurrentQueue.h.

template<typename T>
HazardPtr* OgreHaptics::ConcurrentQueue< T >::HazardPtr::next [protected]

template<typename T>
Node* OgreHaptics::ConcurrentQueue< T >::HazardPtr::hazards[2] [protected]

Array of pointers to Nodes which are marked as hazardous.

At most two hazards are present in the queue routines.

Definition at line 131 of file OgreHapticsConcurrentQueue.h.

Referenced by OgreHaptics::ConcurrentQueue< T >::HazardPtr::HazardPtr().

template<typename T>
NodeList OgreHaptics::ConcurrentQueue< T >::HazardPtr::retiredList [protected]

List of by the owner thread retired nodes, marked for reclaimation.

Definition at line 134 of file OgreHapticsConcurrentQueue.h.

Referenced by OgreHaptics::ConcurrentQueue< OgreHaptics::EventArgs * >::~ConcurrentQueue().


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

Last modified Tue Jan 6 22:31:25 2009