From f1defe4e9ff3241226a0cee76d3ff7212b73fa48 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 1 Feb 2018 19:00:38 -0800 Subject: [PATCH] mark NamedLockPattern as deprecated just too hard to use (exception) safely --- src/remoteClient/clientContextImpl.cpp | 34 +++++++++----------------- src/utils/pv/namedLockPattern.h | 4 ++- 2 files changed, 14 insertions(+), 24 deletions(-) diff --git a/src/remoteClient/clientContextImpl.cpp b/src/remoteClient/clientContextImpl.cpp index ab8271c..73124a9 100644 --- a/src/remoteClient/clientContextImpl.cpp +++ b/src/remoteClient/clientContextImpl.cpp @@ -4458,29 +4458,17 @@ private: if (priority < ChannelProvider::PRIORITY_MIN || priority > ChannelProvider::PRIORITY_MAX) throw std::range_error("priority out of bounds"); - bool lockAcquired = true; // TODO namedLocker->acquireSynchronizationObject(name, LOCK_TIMEOUT); - if (lockAcquired) - { - try - { - /* Note that our channels have an internal ref. to us. - * Thus having active channels will *not* keep us alive. - * Use code must explicitly keep our external ref. as well - * as our channels. - */ - pvAccessID cid = generateCID(); - return InternalChannelImpl::create(internal_from_this(), cid, name, requester, priority, addresses); - } - catch(std::exception& e) { - LOG(logLevelError, "createChannelInternal() exception: %s\n", e.what()); - return ClientChannelImpl::shared_pointer(); - } - // TODO namedLocker.releaseSynchronizationObject(name); - } - else - { - // TODO is this OK? - throw std::runtime_error("Failed to obtain synchronization lock for '" + name + "', possible deadlock."); + try { + /* Note that our channels have an internal ref. to us. + * Thus having active channels will *not* keep us alive. + * Use code must explicitly keep our external ref. as well + * as our channels. + */ + pvAccessID cid = generateCID(); + return InternalChannelImpl::create(internal_from_this(), cid, name, requester, priority, addresses); + } catch(std::exception& e) { + LOG(logLevelError, "createChannelInternal() exception: %s\n", e.what()); + return ClientChannelImpl::shared_pointer(); } } diff --git a/src/utils/pv/namedLockPattern.h b/src/utils/pv/namedLockPattern.h index 389b7a4..bf210c9 100644 --- a/src/utils/pv/namedLockPattern.h +++ b/src/utils/pv/namedLockPattern.h @@ -15,6 +15,8 @@ # undef epicsExportSharedSymbols #endif +#include + #include #include #include @@ -35,7 +37,7 @@ namespace pvAccess { * NamedLockPattern */ template > -class NamedLockPattern +class EPICS_DEPRECATED NamedLockPattern { public: /**