summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2014-01-13 10:46:11 +0100
committerPaul Davis <paul@linuxaudiosystems.com>2014-01-13 09:39:50 -0500
commit1e4e6499e37d83b7e5a76f9d7425f4830f0d830e (patch)
tree93f83a689f7139b630362d019ce2ca28cf2adb67 /libs
parent1b24aad933a850f61d7442778134a001b2002ec2 (diff)
fix deadlock when removing monitoring-section
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/route.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index 14a1041cba..655ba7d53d 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -1377,7 +1377,7 @@ Route::clear_processors (Placement p)
}
int
-Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStreams* err, bool)
+Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStreams* err, bool need_process_lock)
{
// TODO once the export point can be configured properly, do something smarter here
if (processor == _capturing_processor) {
@@ -1397,7 +1397,10 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
processor_max_streams.reset();
{
- Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
+ Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock (), Glib::Threads::NOT_LOCK);
+ if (need_process_lock) {
+ lx.acquire();
+ }
Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorState pstate (this);
@@ -1457,6 +1460,9 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
}
}
}
+ if (need_process_lock) {
+ lx.release();
+ }
}
reset_instrument_info ();
@@ -4152,8 +4158,7 @@ Route::has_external_redirects () const
boost::shared_ptr<Processor>
Route::the_instrument () const
{
- Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
- Glib::Threads::RWLock::WriterLock lm (_processor_lock);
+ Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
return the_instrument_unlocked ();
}