X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fpbd%2Fpbd%2Frcu.h;h=e81db8ba8717108d9cb8dcf110bb2fee219c4a74;hb=1ae094813858a2b8cf5b08569edcb9b15d910729;hp=58a92a206a574e3e4066af422ff065cbfad304b8;hpb=c5619a0f981161b441da1216de1f9c2e26190768;p=ardour.git 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 - - + template class RCUManager { @@ -43,7 +42,7 @@ public: } - virtual boost::shared_ptr write_copy () + boost::shared_ptr write_copy () { m_lock.lock(); @@ -64,11 +63,11 @@ public: current_write_old = RCUManager::m_rcu_value; boost::shared_ptr new_copy (new T(**current_write_old)); - + return new_copy; } - virtual bool update (boost::shared_ptr new_value) + bool update (boost::shared_ptr 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;