ardour
|
#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) |
CrossThreadPool * | per_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 |
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.
void PerThreadPool::add_to_trash | ( | CrossThreadPool * | p | ) |
Add a CrossThreadPool to our trash, if we have one. If not, a warning is emitted.
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.
n | Name. |
isize | Size of each item in the pool. |
nitems | Number of items in the pool. |
|
inline |
CrossThreadPool * PerThreadPool::per_thread_pool | ( | bool | must_exist = true | ) |
void PerThreadPool::set_trash | ( | RingBuffer< CrossThreadPool * > * | t | ) |
|
private |
|
private |
|
private |
mutex to protect either changes to the _trash variable, or writes to the RingBuffer