mark NamedLockPattern as deprecated

just too hard to use (exception) safely
This commit is contained in:
Michael Davidsaver
2018-02-01 19:00:38 -08:00
parent 58f996fd98
commit f1defe4e9f
2 changed files with 14 additions and 24 deletions

View File

@@ -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();
}
}

View File

@@ -15,6 +15,8 @@
# undef epicsExportSharedSymbols
#endif
#include <compilerDependencies.h>
#include <pv/lock.h>
#include <pv/pvType.h>
#include <pv/sharedPtr.h>
@@ -35,7 +37,7 @@ namespace pvAccess {
* NamedLockPattern
*/
template <class Key, class Compare = std::less<Key> >
class NamedLockPattern
class EPICS_DEPRECATED NamedLockPattern
{
public:
/**