Tervel
1.0.0
A collection of wait-free containers and algorithms.
|
This class is used for the creation of Hazard Pointer Protected Objects Objects which extend it have the ability to call safeFree which delays the calling of the objects destructor until it is safe to do so. More...
#include <hp_element.h>
Public Member Functions | |
Element () | |
virtual | ~Element () |
void | safe_delete (bool no_check=false, ElementList *const element_list=tervel::tl_thread_info->get_hp_element_list()) |
This function is used to free a hazard pointer protected object if it is safe to do so OR add it to a list to be freed later. More... | |
virtual bool | on_watch (std::atomic< void * > *address, void *expected) |
This function is used to achieve a strong watch on an Element. More... | |
virtual bool | on_is_watched () |
This function is used to check a strong watch on an Element. More... | |
virtual void | on_unwatch () |
This function is used to remove a strong watch on an Element. More... | |
Private Member Functions | |
Element * | next () |
Helper method for getting the next pointer. More... | |
void | next (Element *next) |
Helper method for setting the next pointer. More... | |
DISALLOW_COPY_AND_ASSIGN (Element) | |
Private Attributes | |
Element * | next_ {nullptr} |
friend | ListManager |
friend | ElementList |
This class is used for the creation of Hazard Pointer Protected Objects Objects which extend it have the ability to call safeFree which delays the calling of the objects destructor until it is safe to do so.
To achieve more advance functionality, the user can also extend Descriptor class which will provides on_watch, on_unwatch, and on_is_watch functions.
|
inline |
|
inlinevirtual |
|
private |
|
inlineprivate |
Helper method for getting the next pointer.
|
inlineprivate |
Helper method for setting the next pointer.
|
inlinevirtual |
This function is used to check a strong watch on an Element.
Classes wishing to express this should override this function.
Reimplemented in tervel::algorithms::wf::mcas::MultiWordCompareAndSwap< T >, and tervel::util::OpRecord.
|
inlinevirtual |
This function is used to remove a strong watch on an Element.
Classes wishing to express this should override this function.
Reimplemented in tervel::util::OpRecord.
|
inlinevirtual |
This function is used to achieve a strong watch on an Element.
Classes wishing to express this should override this function.
address | the expected was load from |
expected | the last known value of address |
Reimplemented in tervel::util::OpRecord, and tervel::containers::wf::RingBuffer< T >::Helper< T >.
|
inline |
This function is used to free a hazard pointer protected object if it is safe to do so OR add it to a list to be freed later.
It also calls 'try_to_free_Elements' in an attempt to free previously unfreeable objects.
no_check | if true then the object is imeditly deleted |
element_list | the list to append the object to until it is safe |
|
private |
|
private |
|
private |