ardour
Public Member Functions | Private Attributes | List of all members
PerThreadPool Class Reference

#include <pool.h>

Public Member Functions

 PerThreadPool ()
 
const Glib::Threads::Private
< CrossThreadPool > & 
key () const
 
void create_per_thread_pool (std::string name, unsigned long item_size, unsigned long nitems)
 
CrossThreadPoolper_thread_pool (bool must_exist=true)
 
void set_trash (RingBuffer< CrossThreadPool * > *t)
 
void add_to_trash (CrossThreadPool *)
 

Private Attributes

Glib::Threads::Private
< CrossThreadPool
_key
 
std::string _name
 
Glib::Threads::Mutex _trash_mutex
 
RingBuffer< CrossThreadPool * > * _trash
 

Detailed Description

A class to manage per-thread pools of memory. One object of this class is instantiated, and then it is used to create per-thread pools for 1 or more threads as required.

Definition at line 123 of file pool.h.

Constructor & Destructor Documentation

PerThreadPool::PerThreadPool ( )

Definition at line 161 of file pool.cc.

Member Function Documentation

void PerThreadPool::add_to_trash ( CrossThreadPool p)

Add a CrossThreadPool to our trash, if we have one. If not, a warning is emitted.

Definition at line 201 of file pool.cc.

void PerThreadPool::create_per_thread_pool ( std::string  name,
unsigned long  item_size,
unsigned long  nitems 
)

Create a new CrossThreadPool and set the current thread's private _key to point to it.

Parameters
nName.
isizeSize of each item in the pool.
nitemsNumber of items in the pool.

Definition at line 173 of file pool.cc.

const Glib::Threads::Private<CrossThreadPool>& PerThreadPool::key ( ) const
inline

Definition at line 128 of file pool.h.

CrossThreadPool * PerThreadPool::per_thread_pool ( bool  must_exist = true)
Returns
CrossThreadPool for the current thread, which must previously have been created by calling create_per_thread_pool in the current thread.

Definition at line 182 of file pool.cc.

void PerThreadPool::set_trash ( RingBuffer< CrossThreadPool * > *  t)

Definition at line 193 of file pool.cc.

Member Data Documentation

Glib::Threads::Private<CrossThreadPool> PerThreadPool::_key
private

Definition at line 137 of file pool.h.

std::string PerThreadPool::_name
private

Definition at line 138 of file pool.h.

RingBuffer<CrossThreadPool*>* PerThreadPool::_trash
private

Definition at line 142 of file pool.h.

Glib::Threads::Mutex PerThreadPool::_trash_mutex
private

mutex to protect either changes to the _trash variable, or writes to the RingBuffer

Definition at line 141 of file pool.h.


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