Tervel  1.0.0
A collection of wait-free containers and algorithms.
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
tervel::util::memory::hp::ElementList Class Reference

Defines a list of objects which are stored until they are safe to be freed. More...

#include <hp_list.h>

Public Member Functions

 ElementList (ListManager *manager)
 
 ~ElementList ()
 

Public Attributes

friend Element
 

Private Member Functions

void send_to_manager ()
 Sends all elements managed by this list to the parent. More...
 
void add_to_unsafe (Element *elem)
 This function adds an Element to the unsafe list. More...
 
void try_to_free_elements (bool dont_check=false)
 Tries to free elements from the unsafe list. More...
 

Private Attributes

ListManagermanager_
 This list's manager. More...
 
Elementelement_list_ {nullptr}
 A linked list of list elements. More...
 

Detailed Description

Defines a list of objects which are stored until they are safe to be freed.

The list is represented as a linked list of HP Elements

Further, this object has a parent who is shared amongst other threads. When it is to be destroyed, it sends its remaining elements to the parent, relinquishing ownership of said elements.

Constructor & Destructor Documentation

tervel::util::memory::hp::ElementList::ElementList ( ListManager manager)
inlineexplicit
tervel::util::memory::hp::ElementList::~ElementList ( )
inline

Member Function Documentation

void tervel::util::memory::hp::ElementList::add_to_unsafe ( Element elem)
private

This function adds an Element to the unsafe list.

Parameters
elemThe element to add
void tervel::util::memory::hp::ElementList::send_to_manager ( )
private

Sends all elements managed by this list to the parent.

void tervel::util::memory::hp::ElementList::try_to_free_elements ( bool  dont_check = false)
private

Tries to free elements from the unsafe list.

Parameters
dont_checkIf true, it ignores safety checks

Member Data Documentation

friend tervel::util::memory::hp::ElementList::Element
Element* tervel::util::memory::hp::ElementList::element_list_ {nullptr}
private

A linked list of list elements.

Elements are freed when they are no longer referenced by other threads.

ListManager* tervel::util::memory::hp::ElementList::manager_
private

This list's manager.


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