diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-02-26 19:02:48 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-02-26 19:02:48 +0000 |
commit | 3f95dc7a08cfd81481ccb27c0d0b67c814e16779 (patch) | |
tree | fd8e4797963786e034b36580bfda922ce4427440 /libs | |
parent | 44a3f5419b5d51dc60c7024294fca4a7f2824491 (diff) |
clean up RCU fix even more; nedko's missing sources patch
git-svn-id: svn://localhost/ardour2/trunk@1514 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/session_command.cc | 2 | ||||
-rw-r--r-- | libs/ardour/session_midi.cc | 2 | ||||
-rw-r--r-- | libs/pbd/pbd/rcu.h | 20 |
3 files changed, 11 insertions, 13 deletions
diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc index 8c64f9764a..ef2196ed13 100644 --- a/libs/ardour/session_command.cc +++ b/libs/ardour/session_command.cc @@ -392,7 +392,7 @@ Session::GlobalMeteringStateCommand::get_state() if (r) { child->add_property (X_("id"), r->id().to_s()); - const char* meterstr; + const char* meterstr = 0; switch (x->second) { case MeterInput: diff --git a/libs/ardour/session_midi.cc b/libs/ardour/session_midi.cc index 4c899d5909..a043a60c27 100644 --- a/libs/ardour/session_midi.cc +++ b/libs/ardour/session_midi.cc @@ -136,7 +136,7 @@ Session::set_mmc_device_id (uint32_t device_id) int Session::set_mmc_port (string port_tag) { - MIDI::byte old_device_id; + MIDI::byte old_device_id = 0; bool reset_id = false; if (port_tag.length() == 0) { diff --git a/libs/pbd/pbd/rcu.h b/libs/pbd/pbd/rcu.h index c9088d51df..86cc6e8cab 100644 --- a/libs/pbd/pbd/rcu.h +++ b/libs/pbd/pbd/rcu.h @@ -10,23 +10,21 @@ template<class T> class RCUManager { public: - RCUManager (T* new_rcu_value) { - x.m_rcu_value = new boost::shared_ptr<T> (new_rcu_value); + m_rcu_value = new boost::shared_ptr<T> (new_rcu_value); } + + virtual ~RCUManager() { delete m_rcu_value; } - virtual ~RCUManager() { delete x.m_rcu_value; } - - boost::shared_ptr<T> reader () const { return *((boost::shared_ptr<T> *) g_atomic_pointer_get (&x.gptr)); } + boost::shared_ptr<T> reader () const { return *((boost::shared_ptr<T> *) g_atomic_pointer_get ((volatile gpointer*) &m_rcu_value)); } virtual boost::shared_ptr<T> write_copy () = 0; virtual bool update (boost::shared_ptr<T> new_value) = 0; + volatile gpointer* pointer() const { return (volatile gpointer*) &m_rcu_value; } + protected: - union { - boost::shared_ptr<T>* m_rcu_value; - volatile gpointer gptr; - } x; + volatile boost::shared_ptr<T>* m_rcu_value; }; @@ -59,7 +57,7 @@ public: // store the current - current_write_old = RCUManager<T>::x.m_rcu_value; + current_write_old = (boost::shared_ptr<T>*) RCUManager<T>::m_rcu_value; boost::shared_ptr<T> new_copy (new T(**current_write_old)); @@ -75,7 +73,7 @@ public: // update, checking that nobody beat us to it - bool ret = g_atomic_pointer_compare_and_exchange (&RCUManager<T>::x.gptr, + bool ret = g_atomic_pointer_compare_and_exchange (RCUManager<T>::pointer(), (gpointer) current_write_old, (gpointer) new_spp); |