aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/LoadedNetwork.cpp
diff options
context:
space:
mode:
authorMatthew Bentham <matthew.bentham@arm.com>2019-03-19 10:11:01 +0000
committerMatthew Bentham <matthew.bentham@arm.com>2019-03-19 10:14:31 +0000
commit2a326b5bbff91ffaedd9017f388aa45862047743 (patch)
tree3d91e97fd04c8e966c4792a42e20cbd1c61ab642 /src/armnn/LoadedNetwork.cpp
parent3e14a9d2033530df49546ab0da63ad4b6470f551 (diff)
downloadarmnn-2a326b5bbff91ffaedd9017f388aa45862047743.tar.gz
MLCE-105 Fix use of std::unique_lock in LoadedNetwork
You can't use a unique_lock to check lock ownership by a particular thread - it just checks whether the mutex is locked by that lock. Change-Id: I28190dc3bea91b3cc68f9b9381751e70fd70f43f Signed-off-by: Matthew Bentham <matthew.bentham@arm.com>
Diffstat (limited to 'src/armnn/LoadedNetwork.cpp')
-rw-r--r--src/armnn/LoadedNetwork.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/armnn/LoadedNetwork.cpp b/src/armnn/LoadedNetwork.cpp
index 3464fb0277..4221d36036 100644
--- a/src/armnn/LoadedNetwork.cpp
+++ b/src/armnn/LoadedNetwork.cpp
@@ -73,7 +73,6 @@ std::unique_ptr<LoadedNetwork> LoadedNetwork::MakeLoadedNetwork(std::unique_ptr<
LoadedNetwork::LoadedNetwork(std::unique_ptr<OptimizedNetwork> net)
: m_OptimizedNetwork(std::move(net))
- , m_WorkingMemLock(m_WorkingMemMutex, std::defer_lock)
{
// Create a profiler and register it for the current thread.
m_Profiler = std::make_shared<Profiler>();
@@ -410,7 +409,6 @@ void LoadedNetwork::EnqueueOutput(const BindableLayer& layer, ITensorHandle* ten
void LoadedNetwork::AllocateWorkingMemory()
{
- BOOST_ASSERT_MSG(m_WorkingMemLock.owns_lock(), "Cannot allocate working memory if mutex is not already locked.");
if (m_IsWorkingMemAllocated)
{
return;
@@ -428,7 +426,7 @@ void LoadedNetwork::AllocateWorkingMemory()
void LoadedNetwork::FreeWorkingMemory()
{
- std::lock_guard<UniqueMutexLock> lockGuard(m_WorkingMemLock);
+ std::lock_guard<std::mutex> lockGuard(m_WorkingMemMutex);
if (!m_IsWorkingMemAllocated)
{
return;
@@ -457,7 +455,7 @@ bool LoadedNetwork::Execute()
try
{
- std::lock_guard<UniqueMutexLock> lockGuard(m_WorkingMemLock);
+ std::lock_guard<std::mutex> lockGuard(m_WorkingMemMutex);
AllocateWorkingMemory();
for (auto& input : m_InputQueue)