changeset 14:b101cc2ae1ab

* Introduce potentially-separate read and write ring buffers, so we can swap in a new set when something changes -- thus allowing us to respond quickly when something changes during playback, without losing the long buffers * Some fixes for display & editing
author Chris Cannam
date Fri, 27 Jan 2006 18:04:07 +0000
parents 1fa7cc0d008b
children 47500c27ac26
files base/Scavenger.h
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/base/Scavenger.h	Thu Jan 26 18:01:38 2006 +0000
+++ b/base/Scavenger.h	Fri Jan 27 18:04:07 2006 +0000
@@ -48,7 +48,7 @@
      * Call from a non-RT thread.
      * Only one thread should be calling this on any given scavenger.
      */
-    void scavenge();
+    void scavenge(bool clearNow = false);
 
 protected:
     typedef std::pair<T *, int> ObjectTimePair;
@@ -121,7 +121,7 @@
 
 template <typename T>
 void
-Scavenger<T>::scavenge()
+Scavenger<T>::scavenge(bool clearNow)
 {
 //    std::cerr << "Scavenger::scavenge: scavenged " << m_scavenged << ", claimed " << m_claimed << std::endl;
 
@@ -133,7 +133,8 @@
 
     for (size_t i = 0; i < m_objects.size(); ++i) {
 	ObjectTimePair &pair = m_objects[i];
-	if (pair.first != 0 && pair.second + m_sec < sec) {
+	if (clearNow ||
+	    (pair.first != 0 && pair.second + m_sec < sec)) {
 	    T *ot = pair.first;
 	    pair.first = 0;
 	    delete ot;