Public Member Functions

Raul::Maid Class Reference
[Realtime Audio Utility Library]

Explicitly driven garbage collector. More...

#include <Maid.hpp>

Collaboration diagram for Raul::Maid:
Collaboration graph

List of all members.

Public Member Functions

 Maid (size_t size)
void push (Raul::Deletable *obj)
 Push a raw pointer to be deleted when cleanup() is called next.
void manage (SharedPtr< Raul::Deletable > ptr)
 Manage a SharedPtr.
void cleanup ()
 Free all the objects in the queue (passed by push()).

Detailed Description

Explicitly driven garbage collector.

This is used by realtime threads to allow hard realtime deletion of objects (push() is realtime safe).

You can also manage a SharedPtr, so cleanup() will delete it when all references are dropped (except the one held by the Maid itself). This allows using a SharedPtr freely in hard realtime threads without having to worry about deletion accidentally occuring in the realtime thread.

cleanup() should be called periodically to free memory, often enough to prevent the queue from overflowing. This is probably best done by the main thread to avoid the overhead of having a thread just to delete things.


Member Function Documentation

void Raul::Maid::push ( Raul::Deletable obj  )  [inline]

Push a raw pointer to be deleted when cleanup() is called next.

Realtime safe.

void Raul::Maid::manage ( SharedPtr< Raul::Deletable ptr  ) 

Manage a SharedPtr.

NOT realtime safe.

ptr is guaranteed to be deleted in the context that calls cleanup()


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