fix deadlock when removing monitoring-section

This commit is contained in:
Robin Gareus 2014-01-13 10:46:11 +01:00 committed by Paul Davis
parent 1b24aad933
commit 1e4e6499e3

View file

@ -1377,7 +1377,7 @@ Route::clear_processors (Placement p)
} }
int 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 // TODO once the export point can be configured properly, do something smarter here
if (processor == _capturing_processor) { if (processor == _capturing_processor) {
@ -1397,7 +1397,10 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
processor_max_streams.reset(); 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); Glib::Threads::RWLock::WriterLock lm (_processor_lock);
ProcessorState pstate (this); 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 (); reset_instrument_info ();
@ -4152,8 +4158,7 @@ Route::has_external_redirects () const
boost::shared_ptr<Processor> boost::shared_ptr<Processor>
Route::the_instrument () const Route::the_instrument () const
{ {
Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ()); Glib::Threads::RWLock::ReaderLock lm (_processor_lock);
Glib::Threads::RWLock::WriterLock lm (_processor_lock);
return the_instrument_unlocked (); return the_instrument_unlocked ();
} }