|
Ardour
9.0-pre0-1952-gc5e0b21049
|
#include <pool.h>
Public Member Functions | |
| CrossThreadPool (std::string n, unsigned long isize, unsigned long nitems, PerThreadPool *, PoolDumpCallback) | |
| void * | alloc () |
| void | push (void *) |
| PerThreadPool * | parent () const |
| bool | empty () |
| guint | pending_size () const |
| void | flush_pending () |
| void | flush_pending_with_ev (void *) |
Public Member Functions inherited from PBD::Pool | |
| Pool (std::string name, unsigned long item_size, unsigned long nitems, PoolDumpCallback cb=NULL) | |
| virtual | ~Pool () |
| virtual void | release (void *) |
| std::string | name () const |
| guint | available () const |
| guint | used () const |
| guint | total () const |
Private Attributes | |
| PBD::RingBuffer< void * > | pending |
| PerThreadPool * | _parent |
Additional Inherited Members | |
Protected Attributes inherited from PBD::Pool | |
| PBD::RingBuffer< void * > | free_list |
| a list of pointers to free items within block More... | |
| std::string | _name |
Management of a per-thread pool of data that is allocated by one thread and freed by one other thread. Not safe for use when there is more than 1 reader and 1 writer.
This is basically a wrapper around a thread-local storage instance of a ringbuffer, made safe for use in the case where multiple threads allocate from the ringbuffer and a single thread "frees" the allocations.
Rather than using locks, each thread has its own ringbuffer (and associated data), and so it calls alloc(), passes a pointer to the result of the alloc to another thread, which later calls push() to "free" it.
| PBD::CrossThreadPool::CrossThreadPool | ( | std::string | n, |
| unsigned long | isize, | ||
| unsigned long | nitems, | ||
| PerThreadPool * | , | ||
| PoolDumpCallback | |||
| ) |
|
virtual |
Reimplemented from PBD::Pool.
| bool PBD::CrossThreadPool::empty | ( | ) |
| void PBD::CrossThreadPool::flush_pending | ( | ) |
| void PBD::CrossThreadPool::flush_pending_with_ev | ( | void * | ) |
|
inline |
| void PBD::CrossThreadPool::push | ( | void * | ) |
|
private |
|
private |