22 #ifndef SV_SCAVENGER_H 23 #define SV_SCAVENGER_H 47 Scavenger(
int sec = 2,
int defaultObjectListSize = 200);
60 void scavenge(
bool clearNow =
false);
105 template <
typename T>
109 for (
size_t i = 0; i <
m_objects.size(); ++i) {
111 if (pair.first != 0) {
123 template <
typename T>
130 (void)gettimeofday(&tv, 0);
131 time_t sec = tv.tv_sec;
133 for (
size_t i = 0; i <
m_objects.size(); ++i) {
135 if (pair.first == 0) {
143 std::cerr <<
"WARNING: Scavenger::claim(" << t <<
"): run out of slots, " 144 <<
"using non-RT-safe method" << std::endl;
148 template <
typename T>
157 (void)gettimeofday(&tv, 0);
158 time_t sec = tv.tv_sec;
160 for (
size_t i = 0; i <
m_objects.size(); ++i) {
163 (pair.first != 0 && pair.second +
m_sec < sec)) {
176 template <
typename T>
183 (void)gettimeofday(&tv, 0);
188 template <
typename T>
193 for (
typename ObjectList::iterator i =
m_excess.begin();
Scavenger(int sec=2, int defaultObjectListSize=200)
std::list< T * > ObjectList
ScavengerArrayWrapper(T *array)
A very simple class that facilitates running things like plugins without locking, by collecting unwan...
void scavenge(bool clearNow=false)
Call from a non-RT thread.
A wrapper to permit arrays to be scavenged.
std::pair< T *, time_t > ObjectTimePair
std::vector< ObjectTimePair > ObjectTimeList
void claim(T *t)
Call from an RT thread etc., to pass ownership of t to us.