CNum 0.2.1
CPU-optimized ML library for C++
Loading...
Searching...
No Matches
HazardPointer.h File Reference
#include <atomic>
#include <vector>
#include <stdexcept>
#include <functional>
#include <unordered_set>
#include "CNum/DataStructs/Memory/HazardPointer.tpp"

Go to the source code of this file.

Classes

struct  CNum::DataStructs::HazardPointer::HazardSlot
 A slot in which to store a protected pointer. More...
struct  CNum::DataStructs::HazardPointer::Retire
 A retired protected pointer. More...
class  CNum::DataStructs::HazardPointer::HazardPtrDomain
 The domain of all hazard pointers. More...
class  CNum::DataStructs::HazardPointer::HazardPtrGuard
 Thread local guards for hazard pointers. More...

Namespaces

namespace  CNum::DataStructs::HazardPointer
 Tools for protecting "hazerdous" objects in memory.
namespace  CNum
 The umbrella namespace from which you can access all modules of CNum.
namespace  CNum::DataStructs
 The data structures used in CNum.

Functions

template<typename T>
void CNum::DataStructs::HazardPointer::default_hazard_ptr_delete (void *ptr)
 Default delete function for pointers.
template<typename T>
T * CNum::DataStructs::HazardPointer::protect (::std::atomic< T * > &src, HazardSlot *slot)
 Protect an atomic pointer.
template<typename T>
void CNum::DataStructs::HazardPointer::protect (T *src, HazardSlot *slot)
 Protect a raw pointer.
template<typename T>
void CNum::DataStructs::HazardPointer::retire (T *ptr)
 Retire a pointer.
void CNum::DataStructs::HazardPointer::scan ()
 Free memory of objects pointed to by pointers that are no longer hazardous.
void CNum::DataStructs::HazardPointer::flush ()
 Force a scan.

Variables

constexpr size_t CNum::DataStructs::HazardPointer::MAX_HP_SLOTS = 1024
 The maximum amount of hazard pointer slots (globally) Add more as needed.
constexpr size_t CNum::DataStructs::HazardPointer::SLOTS_PER_THREAD = 2
 The amount of slots 1 thread can have.
constexpr size_t CNum::DataStructs::HazardPointer::RETIRED_SCAN_THRESHOLD = 64
 The threshold of Retire objects in the tls_retire at which we call scan().
thread_local ::std::vector< RetireCNum::DataStructs::HazardPointer::tls_retire
 The thread local storage of retired objects.