From 96ce9c304e0a3e4a6b9882bbf1b831fbeaca6f11 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 15 Apr 2015 18:13:56 +0200 Subject: Replace control list locks with RWLocks towards fixing #6238 and #6096. GUI thread: #2 Glib::Threads::Mutex::Lock::Lock #3 Evoral::ControlList::eval #4 Evoral::Control::get_double #5 ARDOUR::AutomationControl::get_value #6 ProcessorEntry::Control::control_changed .. #15 PBD::Timer::timeout_handler at the same time: Audio Thread (try-lock, fails) #0 Evoral::Curve::rt_safe_get_vector #1 ARDOUR::Amp::setup_gain_automation #2 ARDOUR::Route::process_output_buffers Due to the failed try-lock.. AMP::_apply_gain_automation is false. and Amp::run() uses a different gain factor. -> click. --- libs/evoral/evoral/ControlList.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'libs/evoral/evoral/ControlList.hpp') diff --git a/libs/evoral/evoral/ControlList.hpp b/libs/evoral/evoral/ControlList.hpp index 6353813097..7a828264bd 100644 --- a/libs/evoral/evoral/ControlList.hpp +++ b/libs/evoral/evoral/ControlList.hpp @@ -109,7 +109,7 @@ public: EventList::size_type size() const { return _events.size(); } double length() const { - Glib::Threads::Mutex::Lock lm (_lock); + Glib::Threads::RWLock::ReaderLock lm (_lock); return _events.empty() ? 0.0 : _events.back()->when; } bool empty() const { return _events.empty(); } @@ -184,18 +184,18 @@ public: std::pair control_points_adjacent (double when); template void apply_to_points (T& obj, void (T::*method)(const ControlList&)) { - Glib::Threads::Mutex::Lock lm (_lock); + Glib::Threads::RWLock::WriterLock lm (_lock); (obj.*method)(*this); } double eval (double where) { - Glib::Threads::Mutex::Lock lm (_lock); + Glib::Threads::RWLock::ReaderLock lm (_lock); return unlocked_eval (where); } double rt_safe_eval (double where, bool& ok) { - Glib::Threads::Mutex::Lock lm (_lock, Glib::Threads::TRY_LOCK); + Glib::Threads::RWLock::ReaderLock lm (_lock, Glib::Threads::TRY_LOCK); if ((ok = lm.locked())) { return unlocked_eval (where); @@ -226,7 +226,7 @@ public: double default_value() const { return _default_value; } // FIXME: const violations for Curve - Glib::Threads::Mutex& lock() const { return _lock; } + Glib::Threads::RWLock& lock() const { return _lock; } LookupCache& lookup_cache() const { return _lookup_cache; } SearchCache& search_cache() const { return _search_cache; } @@ -297,7 +297,7 @@ protected: mutable LookupCache _lookup_cache; mutable SearchCache _search_cache; - mutable Glib::Threads::Mutex _lock; + mutable Glib::Threads::RWLock _lock; Parameter _parameter; ParameterDescriptor _desc; -- cgit v1.2.3