This class is used to hold the memory management information (Header) and a descriptor object.
More...
#include <pool_element.h>
|
struct | Header |
| All the member variables of PoolElement are stored in a struct so that the left over memory for cache padding can be easily calculated. More...
|
|
This class is used to hold the memory management information (Header) and a descriptor object.
It is important to sepearte them to prevent the case where a thread attempts to dereference an object while its type id is being changed.
tervel::util::memory::rc::PoolElement::PoolElement |
( |
PoolElement * |
next = nullptr | ) |
|
|
inlineexplicit |
tervel::util::memory::rc::PoolElement::~PoolElement |
( |
| ) |
|
|
inline |
void tervel::util::memory::rc::PoolElement::cleanup_descriptor |
( |
| ) |
|
|
inline |
Should be called by the owner of this element when the descriptor in this element is no longer needed, and it is safe to destroy it.
Simply calls the destructor on the internal descriptor.
Descriptor* tervel::util::memory::rc::PoolElement::descriptor |
( |
| ) |
|
|
inline |
Returns a pointer to the associated descriptor of this element.
This pointer may or may not reference a constructed object.
Returns a pointer to the associated descriptor of this element. This pointer may or may not reference a constructed object.
TODO(carlos) add const versions of these accessors
- Returns
- a pointer a descriptor type
tervel::util::memory::rc::PoolElement::DISALLOW_COPY_AND_ASSIGN |
( |
PoolElement |
| ) |
|
|
private |
Header& tervel::util::memory::rc::PoolElement::header |
( |
| ) |
|
|
inline |
A reference to the header which houses all the special info.
A reference to the header which houses all the special info
- Returns
- A reference to the header which houses all the
template<typename DescrType , typename... Args >
void tervel::util::memory::rc::PoolElement::init_descriptor |
( |
Args &&... |
args | ) |
|
Constructs a descriptor of the given type within this pool element.
Caller must be careful that there's not another descriptor already in use in this element, or memory will be stomped and resources might leak.
Call cleanup_descriptor() to call the descriptor's destructor when done with it.
PoolElement* tervel::util::memory::rc::PoolElement::next |
( |
| ) |
|
|
inline |
Helper method for getting the next pointer.
void tervel::util::memory::rc::PoolElement::next |
( |
PoolElement * |
next | ) |
|
|
inline |
Helper method for setting the next pointer.
Header tervel::util::memory::rc::PoolElement::header_ |
|
private |
The documentation for this class was generated from the following file: