Honeycomb  0.1
Component-Model Framework
Classes | Public Types | Public Member Functions | List of all members
honey::lockfree::HazardMem< Config > Class Template Reference

Lock-free memory manager, provides safe memory reclamation for concurrent algorithms. More...

#include <HazardMem.h>

Inheritance diagram for honey::lockfree::HazardMem< Config >:
Inheritance graph
[legend]
Collaboration diagram for honey::lockfree::HazardMem< Config >:
Collaboration graph
[legend]

Public Types

typedef Config::Node Node
 
typedef Config::Link Link
 
typedef Config::Alloc::template rebind< Node >::other Alloc
 

Public Member Functions

 HazardMem (Config &config, const Alloc &alloc, int threadMax)
 
template<class... Args>
NodecreateNode (Args &&...args)
 
void deleteNode (Node &node)
 
NodedeRefLink (Link &link)
 Dereference a link, protects with hazard pointer. May return null. More...
 
void ref (Node &node)
 Add reference to node, sets up hazard pointer. More...
 
void releaseRef (Node &node)
 Release a reference to a node, clears hazard pointer. More...
 
bool casRef (Link &link, const Link &val, const Link &old)
 Compare and swap link. Set link in a concurrent environment. Returns false if the link was changed by another thread. More...
 
void storeRef (Link &link, const Link &val)
 Set link in a single-threaded environment. More...
 

Detailed Description

template<class Config>
class honey::lockfree::HazardMem< Config >

Lock-free memory manager, provides safe memory reclamation for concurrent algorithms.

Based on the paper: "Efficient and Reliable Lock-Free Memory Reclamation Based on Reference Counting", Gidenstam, et al. - 2005

Member Typedef Documentation

template<class Config>
typedef Config::Alloc::template rebind<Node>::other honey::lockfree::HazardMem< Config >::Alloc
template<class Config>
typedef Config::Link honey::lockfree::HazardMem< Config >::Link
template<class Config>
typedef Config::Node honey::lockfree::HazardMem< Config >::Node

Constructor & Destructor Documentation

template<class Config>
honey::lockfree::HazardMem< Config >::HazardMem ( Config &  config,
const Alloc alloc,
int  threadMax 
)
inline
Parameters
config
alloc
threadMaxMax number of threads that can access the memory manager. Use a thread pool and ensure that it has a longer life cycle than the mem manager.

Member Function Documentation

template<class Config>
bool honey::lockfree::HazardMem< Config >::casRef ( Link link,
const Link val,
const Link old 
)
inline

Compare and swap link. Set link in a concurrent environment. Returns false if the link was changed by another thread.

template<class Config>
template<class... Args>
Node& honey::lockfree::HazardMem< Config >::createNode ( Args &&...  args)
inline
template<class Config>
void honey::lockfree::HazardMem< Config >::deleteNode ( Node node)
inline
template<class Config>
Node* honey::lockfree::HazardMem< Config >::deRefLink ( Link link)
inline

Dereference a link, protects with hazard pointer. May return null.

template<class Config>
void honey::lockfree::HazardMem< Config >::ref ( Node node)
inline

Add reference to node, sets up hazard pointer.

template<class Config>
void honey::lockfree::HazardMem< Config >::releaseRef ( Node node)
inline

Release a reference to a node, clears hazard pointer.

template<class Config>
void honey::lockfree::HazardMem< Config >::storeRef ( Link link,
const Link val 
)
inline

Set link in a single-threaded environment.


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