13
0
livetrax/libs/backends/alsa
Robin Gareus 634d325e5d
Prevent deadlock when disconnecting
The backend holds `_port_callback_mutex` while disconnecting ports.
In some cases disconnecting a port can drop the last reference
resulting in a port-deletion from the connection handler.
This in turn will eventually aquire the `_port_callback_mutex`
and deadlock.

This is now circumvented by using atomic operations instead of
taking a lock to set the `_port_change_flag`.

The flag is also used to trigger a latency update in some cases,
atomic is preferable to taking a lock to set this flag.

--

Full bt: https://paste.debian.net/1184056/
Short:

#1  in pthread_mutex_lock ()
#2  in ARDOUR::PortEngineSharedImpl::port_connect_add_remove_callback()
#3  in ARDOUR::BackendPort::~BackendPort()
#4  in ARDOUR::DummyPort::~DummyPort()
#6  in ARDOUR::DummyAudioPort::~DummyAudioPort()
#7  in boost::checked_delete<ARDOUR::BackendPort>(ARDOUR::BackendPort*)
#12 in boost::shared_ptr<ARDOUR::ProtoPort>::reset()
#13 in ARDOUR::Port::drop()
#14 in ARDOUR::Port::~Port()
#15 in ARDOUR::AudioPort::~AudioPort()
#17 in ARDOUR::AudioEngine::add_pending_port_deletion(ARDOUR::Port*)
#20 in boost::detail::sp_counted_base::release()
#37 in ARDOUR::PortManager::connect_callback() at libs/ardour/port_manager.cc:788
#38 in ARDOUR::DummyAudioBackend::main_process_thread() at libs/backends/dummy/dummy_audiobackend.cc:1018
2021-02-04 21:06:20 +01:00
..
alsa_audiobackend.cc Prevent deadlock when disconnecting 2021-02-04 21:06:20 +01:00
alsa_audiobackend.h NO-OP: Consolidate PortConnect code into shared parent class 2020-09-05 23:05:57 +02:00
alsa_midi.cc Consolidate code using pthread_attr_setstacksize 2020-06-06 18:35:44 +02:00
alsa_midi.h
alsa_rawmidi.cc
alsa_rawmidi.h
alsa_sequencer.cc
alsa_sequencer.h
alsa_slave.cc Remove ALSA debug message in optimized builds 2020-09-18 15:40:44 +02:00
alsa_slave.h
select_sleep.h
wscript
zita-alsa-pcmi.cc ALSA: fall back to nearest available buffer-size 2021-01-22 16:07:29 +01:00
zita-alsa-pcmi.h ALSA: only read/clear user-requested nperiods before snd_pcm_start 2020-05-01 23:17:31 +02:00