Turi Create  4.0
turi::buffer_pool< T > Class Template Reference

#include <core/util/buffer_pool.hpp>

Public Member Functions

void init (size_t buffer_size)
 
std::shared_ptr< T > get_new_buffer ()
 
void release_buffer (std::shared_ptr< T > &&buffer)
 

Detailed Description

template<typename T>
class turi::buffer_pool< T >

Implements a buffer pool around collections of T. The buffer is lazily allocated; but only up to 2 * buffer_size entries can exist.

Definition at line 22 of file buffer_pool.hpp.

Member Function Documentation

◆ get_new_buffer()

template<typename T>
std::shared_ptr<T> turi::buffer_pool< T >::get_new_buffer ( )
inline

Returns a new buffer from the buffer pool Can be called in parallel

Definition at line 40 of file buffer_pool.hpp.

◆ init()

template<typename T>
void turi::buffer_pool< T >::init ( size_t  buffer_size)
inline

Initializes the buffer pool to a certain capacity. Can be called in parallel

Definition at line 32 of file buffer_pool.hpp.

◆ release_buffer()

template<typename T>
void turi::buffer_pool< T >::release_buffer ( std::shared_ptr< T > &&  buffer)
inline

Releases a buffer back to the pool Can be called in parallel

Definition at line 67 of file buffer_pool.hpp.


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