diff options
Diffstat (limited to 'libs/pbd/pbd/rcu.h')
-rw-r--r-- | libs/pbd/pbd/rcu.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libs/pbd/pbd/rcu.h b/libs/pbd/pbd/rcu.h index 58a92a206a..e81db8ba87 100644 --- a/libs/pbd/pbd/rcu.h +++ b/libs/pbd/pbd/rcu.h @@ -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; |