|
svcore
1.9
|
A very simple class that facilitates running things like plugins without locking, by collecting unwanted objects and deleting them after a delay so as to be sure nobody's in the middle of using them. More...
#include <Scavenger.h>
Public Member Functions | |
| Scavenger (int sec=2, int defaultObjectListSize=200) | |
| ~Scavenger () | |
| void | claim (T *t) |
| Call from an RT thread etc., to pass ownership of t to us. More... | |
| void | scavenge (bool clearNow=false) |
| Call from a non-RT thread. More... | |
Protected Types | |
| typedef std::pair< T *, int > | ObjectTimePair |
| typedef std::vector< ObjectTimePair > | ObjectTimeList |
| typedef std::list< T * > | ObjectList |
Protected Member Functions | |
| void | pushExcess (T *) |
| void | clearExcess (int) |
Protected Attributes | |
| ObjectTimeList | m_objects |
| int | m_sec |
| ObjectList | m_excess |
| int | m_lastExcess |
| QMutex | m_excessMutex |
| unsigned int | m_claimed |
| unsigned int | m_scavenged |
A very simple class that facilitates running things like plugins without locking, by collecting unwanted objects and deleting them after a delay so as to be sure nobody's in the middle of using them.
Requires scavenge() to be called regularly from a non-RT thread.
This is currently not at all suitable for large numbers of objects – it's just a quick hack for use with things like plugins.
Definition at line 45 of file Scavenger.h.
|
protected |
Definition at line 64 of file Scavenger.h.
|
protected |
Definition at line 65 of file Scavenger.h.
|
protected |
Definition at line 69 of file Scavenger.h.
Definition at line 97 of file Scavenger.h.
Definition at line 107 of file Scavenger.h.
| void Scavenger< T >::claim | ( | T * | t | ) |
Call from an RT thread etc., to pass ownership of t to us.
Only one thread should be calling this on any given scavenger.
Definition at line 126 of file Scavenger.h.
Referenced by DSSIPluginInstance::initialiseGroupMembership().
| void Scavenger< T >::scavenge | ( | bool | clearNow = false | ) |
Call from a non-RT thread.
Only one thread should be calling this on any given scavenger.
Definition at line 151 of file Scavenger.h.
Referenced by DSSIPluginInstance::deactivate().
|
protected |
Definition at line 179 of file Scavenger.h.
|
protected |
Definition at line 191 of file Scavenger.h.
|
protected |
Definition at line 66 of file Scavenger.h.
|
protected |
Definition at line 67 of file Scavenger.h.
|
protected |
Definition at line 70 of file Scavenger.h.
|
protected |
Definition at line 71 of file Scavenger.h.
|
protected |
Definition at line 72 of file Scavenger.h.
|
protected |
Definition at line 76 of file Scavenger.h.
|
protected |
Definition at line 77 of file Scavenger.h.