diff options
-rw-r--r-- | src/armnn/LoadedNetwork.cpp | 6 | ||||
-rw-r--r-- | src/armnn/LoadedNetwork.hpp | 5 |
2 files changed, 4 insertions, 7 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) diff --git a/src/armnn/LoadedNetwork.hpp b/src/armnn/LoadedNetwork.hpp index 03a741fb75..9c0fe0b108 100644 --- a/src/armnn/LoadedNetwork.hpp +++ b/src/armnn/LoadedNetwork.hpp @@ -47,10 +47,11 @@ public: // the shared_ptr's reference counter const std::shared_ptr<Profiler>& GetProfiler() const { return m_Profiler; } - void AllocateWorkingMemory(); void FreeWorkingMemory(); private: + void AllocateWorkingMemory(); + LoadedNetwork(std::unique_ptr<OptimizedNetwork> net); void EnqueueInput(const BindableLayer& layer, ITensorHandle* tensorHandle, const TensorInfo& tensorInfo); @@ -77,9 +78,7 @@ private: WorkloadQueue m_OutputQueue; std::shared_ptr<Profiler> m_Profiler; - using UniqueMutexLock = std::unique_lock<std::mutex>; mutable std::mutex m_WorkingMemMutex; - UniqueMutexLock m_WorkingMemLock; bool m_IsWorkingMemAllocated=false; }; |