RCU-ification of AudioEngine port list, and DiskStreams. not well tested, but basical...
[ardour.git] / libs / pbd / pbd / rcu.h
index 58a92a206a574e3e4066af422ff065cbfad304b8..e81db8ba8717108d9cb8dcf110bb2fee219c4a74 100644 (file)
@@ -5,8 +5,7 @@
 #include "glibmm/thread.h"
  
 #include <list> 
+
 template<class T>
 class RCUManager
 {
@@ -43,7 +42,7 @@ public:
  
        }
  
-       virtual boost::shared_ptr<T> write_copy ()
+       boost::shared_ptr<T> write_copy ()
        {
                m_lock.lock();
 
@@ -64,11 +63,11 @@ public:
                current_write_old = RCUManager<T>::m_rcu_value;
                
                boost::shared_ptr<T> new_copy (new T(**current_write_old));
-               
+
                return new_copy;
        }
  
-       virtual bool update (boost::shared_ptr<T> new_value)
+       bool update (boost::shared_ptr<T> new_value)
        {
                // we hold the lock at this point effectively blocking
                // other writers.
@@ -98,6 +97,11 @@ public:
 
                return ret;
        }
+
+       void flush () {
+               Glib::Mutex::Lock lm (m_lock);
+               m_dead_wood.clear ();
+       }
  
 private:
        Glib::Mutex                      m_lock;