diff --git a/src/lib/utility/interprocess/SharedMemory.cpp b/src/lib/utility/interprocess/SharedMemory.cpp index f032b036..a8d9d398 100644 --- a/src/lib/utility/interprocess/SharedMemory.cpp +++ b/src/lib/utility/interprocess/SharedMemory.cpp @@ -163,6 +163,11 @@ SharedMemory::~SharedMemory() } } +void SharedMemory::unlockSharedMutex() +{ + getMutex().unlock(); +} + std::string SharedMemory::getMemoryName() const { return s_memoryNamePrefix + m_name; diff --git a/src/lib/utility/interprocess/SharedMemory.h b/src/lib/utility/interprocess/SharedMemory.h index a1fa3919..197c3975 100644 --- a/src/lib/utility/interprocess/SharedMemory.h +++ b/src/lib/utility/interprocess/SharedMemory.h @@ -40,7 +40,7 @@ public: template using Set = boost::interprocess::set, boost::interprocess::allocator>; - // Names addressing shared memory objects longer than 29 characters can throw and exception + // Names addressing shared memory objects longer than 29 characters can throw an exception static std::string checkName(const std::string& name); static std::string checkSharedMemory(const std::string& name); static void deleteSharedMemory(const std::string& name); @@ -99,6 +99,8 @@ public: std::string m_memoryName; }; + void unlockSharedMutex(); + private: static const char* s_memoryNamePrefix; static const char* s_mutexNamePrefix; diff --git a/src/lib/utility/interprocess/SharedMemoryGarbageCollector.cpp b/src/lib/utility/interprocess/SharedMemoryGarbageCollector.cpp index 192dbb40..588a8eb7 100644 --- a/src/lib/utility/interprocess/SharedMemoryGarbageCollector.cpp +++ b/src/lib/utility/interprocess/SharedMemoryGarbageCollector.cpp @@ -40,6 +40,7 @@ SharedMemoryGarbageCollector::SharedMemoryGarbageCollector() : m_memory(getMemoryName(), 65536 /* 64 kB */, SharedMemory::OPEN_OR_CREATE) , m_loopIsRunning(false) { + m_memory.unlockSharedMutex(); } SharedMemoryGarbageCollector::~SharedMemoryGarbageCollector()