From ff234c05449e6410a3f38ca27baa951e76a3cc32 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 25 Jul 2011 16:11:00 +0000 Subject: "forward" port IO::ensure_* changes from 2.X for correctness and consistency git-svn-id: svn://localhost/ardour2/branches/3.0@9918 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/io.h | 2 +- libs/ardour/io.cc | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'libs') diff --git a/libs/ardour/ardour/io.h b/libs/ardour/ardour/io.h index f8e30584d4..5a54b903e5 100644 --- a/libs/ardour/ardour/io.h +++ b/libs/ardour/ardour/io.h @@ -241,7 +241,7 @@ class IO : public SessionObject, public Latent boost::shared_ptr find_possible_bundle (const std::string &desired_name); - bool ensure_ports_locked (ChanCount, bool clear, void *src); + int ensure_ports_locked (ChanCount, bool clear, bool& changed); std::string build_legal_port_name (DataType type); int32_t find_port_hole (const char* base); diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index 0d9933cb0c..ae0cdcce29 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -366,13 +366,14 @@ IO::disconnect (void* src) } /** Caller must hold process lock */ -bool -IO::ensure_ports_locked (ChanCount count, bool clear, void* /*src*/) +int +IO::ensure_ports_locked (ChanCount count, bool clear, bool& changed) { assert (!AudioEngine::instance()->process_lock().trylock()); Port* port = 0; - bool changed = false; + + changed = false; for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) { @@ -432,7 +433,7 @@ IO::ensure_ports_locked (ChanCount count, bool clear, void* /*src*/) } } - return changed; + return 0; } /** Caller must hold process lock */ @@ -453,7 +454,9 @@ IO::ensure_ports (ChanCount count, bool clear, void* src) { Glib::Mutex::Lock im (io_lock); - changed = ensure_ports_locked (count, clear, src); + if (ensure_ports_locked (count, clear, changed)) { + return -1; + } } if (changed) { -- cgit v1.2.3