Honeycomb  0.1
Component-Model Framework
Public Types | Public Member Functions | Friends | List of all members
honey::lockfree::FreeList< T > Class Template Reference

Lock-free freelist, allocates re-usable objects and provides automatic storage expansion for concurrent algorithms. More...

#include <Pool.h>

Inheritance diagram for honey::lockfree::FreeList< T >:
Inheritance graph
[legend]
Collaboration diagram for honey::lockfree::FreeList< T >:
Collaboration graph
[legend]

Public Types

typedef T value_type
 
typedef MemPool::Bucket::Handle Handle
 
typedef MemPool::Bucket::TaggedHandle TaggedHandle
 

Public Member Functions

 FreeList (szt capacity=0)
 
void reserve (szt capacity)
 Ensure that enough storage is allocated for a number of objects. More...
 
szt capacity () const
 The number of objects for which storage is allocated. More...
 
T * alloc ()
 Remove object from free list without constructing it. More...
 
template<class... Args>
T * construct (Args &&...args)
 Construct object and remove from free list. More...
 
void free (T *ptr)
 Add object to free list without destroying it. More...
 
void destroy (T *ptr)
 Destroy object and add to free list. More...
 
Handle handle (T *ptr) const
 Get compressed handle for object. More...
 
T * deref (Handle handle) const
 Get object from compressed handle. More...
 

Friends

template<class >
class FreeListAllocator
 

Detailed Description

template<class T>
class honey::lockfree::FreeList< T >

Lock-free freelist, allocates re-usable objects and provides automatic storage expansion for concurrent algorithms.

Memory is only reclaimed upon destruction.

See also
HazardMem for lock-free memory reclamation.

Member Typedef Documentation

template<class T>
typedef MemPool::Bucket::Handle honey::lockfree::FreeList< T >::Handle
template<class T>
typedef T honey::lockfree::FreeList< T >::value_type

Constructor & Destructor Documentation

template<class T>
honey::lockfree::FreeList< T >::FreeList ( szt  capacity = 0)
inline

Member Function Documentation

template<class T>
T* honey::lockfree::FreeList< T >::alloc ( )
inline

Remove object from free list without constructing it.

template<class T>
szt honey::lockfree::FreeList< T >::capacity ( ) const
inline

The number of objects for which storage is allocated.

template<class T>
template<class... Args>
T* honey::lockfree::FreeList< T >::construct ( Args &&...  args)
inline

Construct object and remove from free list.

template<class T>
T* honey::lockfree::FreeList< T >::deref ( Handle  handle) const
inline

Get object from compressed handle.

template<class T>
void honey::lockfree::FreeList< T >::destroy ( T *  ptr)
inline

Destroy object and add to free list.

template<class T>
void honey::lockfree::FreeList< T >::free ( T *  ptr)
inline

Add object to free list without destroying it.

template<class T>
Handle honey::lockfree::FreeList< T >::handle ( T *  ptr) const
inline

Get compressed handle for object.

template<class T>
void honey::lockfree::FreeList< T >::reserve ( szt  capacity)
inline

Ensure that enough storage is allocated for a number of objects.

Friends And Related Function Documentation

template<class T>
template<class >
friend class FreeListAllocator
friend

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