summaryrefslogtreecommitdiff
path: root/libs/ardour/audioengine.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-10-13 17:18:42 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-10-13 17:18:54 -0400
commit8f9a9523d2161ee15975f5f9136ef80d4bfbf3e2 (patch)
treefa82656ffa02c7e9d8a959803f501ab95fcbd482 /libs/ardour/audioengine.cc
parent1552547f650a82487ac72615c8533fd25b4ffc39 (diff)
new scheme for managing port deletion
shared_ptr<Port> now uses a deleter functor which pushes Port* to a lock-free FIFO so that the Port is always deleted (and thus unregistered with the PortEngine/backend) in a safe context w.r.t. various callbacks in the host. Currently the auto_connect_thread in Session has been tasked with doing these deletions.
Diffstat (limited to 'libs/ardour/audioengine.cc')
-rw-r--r--libs/ardour/audioengine.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/ardour/audioengine.cc b/libs/ardour/audioengine.cc
index b8dcc3fce3..cbae19ff51 100644
--- a/libs/ardour/audioengine.cc
+++ b/libs/ardour/audioengine.cc
@@ -1481,3 +1481,19 @@ AudioEngine::set_latency_input_port (const string& name)
{
_latency_input_name = name;
}
+
+void
+AudioEngine::add_pending_port_deletion (Port* p)
+{
+ if (_session) {
+ std::cerr << "Adding " << p->name() << " to pending port deletion list\n";
+ if (_port_deletions_pending.write (&p, 1) != 1) {
+ error << string_compose (_("programming error: port %1 could not be placed on the pending deletion queue\n"), p->name()) << endmsg;
+ }
+ _session->auto_connect_thread_wakeup ();
+ } else {
+ std::cerr << "Directly delete port\n";
+ delete p;
+ }
+}
+