T must implement PoolAllocatable. More...
#include <LockFreePoolAllocator.h>
Public Member Functions | |
| T * | New () |
| Allocates a new object of type T and returns a pointer to it. | |
| void | ClearAll () |
| Deallocates all cached unused nodes in this pool. | |
| void | UnsafeClearAll () |
| A fast method to free all items allocated in the pool. | |
| bool | DebugHasCycle () |
| A debugging function that checks whether the underlying linked list has a cycle or not. Not thread-safe! | |
| void | DumpPool () |
| A debugging function that prints out all the objects in the pool. Not thread-safe! | |
T must implement PoolAllocatable.
| T* kNet::LockFreePoolAllocator< T >::New | ( | ) | [inline] |
Allocates a new object of type T and returns a pointer to it.
Call Free() to deallocate the object.
Referenced by kNet::MessageConnection::AllocateNewMessage().
| void kNet::LockFreePoolAllocator< T >::ClearAll | ( | ) | [inline] |
Deallocates all cached unused nodes in this pool.
Thread-safe and lock-free. If you are manually tearing down the pool and there are no other threads accessing this, you may call the even faster version UnsafeClearAll(), which ignores compare-and-swap updates.
| void kNet::LockFreePoolAllocator< T >::UnsafeClearAll | ( | ) | [inline] |
A fast method to free all items allocated in the pool.
Not thread-safe, only call when you can guarantee there are no threads calling New() or Free().
1.7.1