|
cds
1.3.0
|
Base class for all HRC-based container's node. More...
#include <cds/gc/hrc/hrc.h>
Public Member Functions | |
| unsigned_ref_counter::ref_counter_type | getRefCount () const |
| Returns count of reference for the node. | |
| void | incRefCount () |
| Increments the reference counter of the node. | |
| bool | decRefCount () |
Decrements the reference counter of the node. Returns true if ref counter is 0. | |
| bool | isDeleted () const |
| Returns the mark that the node is deleted or not. | |
Protected Member Functions | |
| virtual void | cleanUp (ThreadGC *pGC)=0 |
| virtual void | terminate (ThreadGC *pGC, bool bConcurrent)=0 |
Protected Attributes | |
| unsigned_ref_counter | m_RC |
| reference counter | |
| std::atomic< bool > | m_bTrace |
| true - node is tracing by Scan | |
| std::atomic< bool > | m_bDeleted |
| @ true - node is deleted | |
Friends | |
| class | GarbageCollector |
| class | ThreadGC |
| class | gc::HRC |
Base class for all HRC-based container's node.
This interface is placed to the separate class since in the presence of a garbage collector the lifetime of the node is greater than lifetime of its container. Reclaimed node may be physically deleted later than its container. So, the ContainerNode must be smarter than the usual.
|
protectedpure virtual |
[Gidenstam 2006]: "The procedure CleanUpNode will make sure that all claimed references from the links of the given node will only point to active nodes, thus removing redundant passages through an arbitrary number of deleted nodes"
The pseudocode of this method must be like following:
Be aware to use hazard pointers inside implementation of this method. cleanUp is called from the container's method when deleting the nodes. However, some hazard pointers may be occupied by container's method. You should allocate new hazard pointers inside cleanUp method, for example:
|
protectedpure virtual |
[Gidenstam 2006]: "The procedure TerminateNode will make sure that none of the links in the given node will have any claim on any other node. TerminateNode is called on a deleted node when there are no claims from any other node or thread to the node"
The pseudocode of this method must be like following: