logic: Force unlock shared memory mutex of SharedMemoryGarbageCollector on creation
This commit is contained in:
@@ -163,6 +163,11 @@ SharedMemory::~SharedMemory()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SharedMemory::unlockSharedMutex()
|
||||||
|
{
|
||||||
|
getMutex().unlock();
|
||||||
|
}
|
||||||
|
|
||||||
std::string SharedMemory::getMemoryName() const
|
std::string SharedMemory::getMemoryName() const
|
||||||
{
|
{
|
||||||
return s_memoryNamePrefix + m_name;
|
return s_memoryNamePrefix + m_name;
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public:
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
using Set = boost::interprocess::set<T, std::less<T>, boost::interprocess::allocator<T, Allocator>>;
|
using Set = boost::interprocess::set<T, std::less<T>, boost::interprocess::allocator<T, 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 checkName(const std::string& name);
|
||||||
static std::string checkSharedMemory(const std::string& name);
|
static std::string checkSharedMemory(const std::string& name);
|
||||||
static void deleteSharedMemory(const std::string& name);
|
static void deleteSharedMemory(const std::string& name);
|
||||||
@@ -99,6 +99,8 @@ public:
|
|||||||
std::string m_memoryName;
|
std::string m_memoryName;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void unlockSharedMutex();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static const char* s_memoryNamePrefix;
|
static const char* s_memoryNamePrefix;
|
||||||
static const char* s_mutexNamePrefix;
|
static const char* s_mutexNamePrefix;
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ SharedMemoryGarbageCollector::SharedMemoryGarbageCollector()
|
|||||||
: m_memory(getMemoryName(), 65536 /* 64 kB */, SharedMemory::OPEN_OR_CREATE)
|
: m_memory(getMemoryName(), 65536 /* 64 kB */, SharedMemory::OPEN_OR_CREATE)
|
||||||
, m_loopIsRunning(false)
|
, m_loopIsRunning(false)
|
||||||
{
|
{
|
||||||
|
m_memory.unlockSharedMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedMemoryGarbageCollector::~SharedMemoryGarbageCollector()
|
SharedMemoryGarbageCollector::~SharedMemoryGarbageCollector()
|
||||||
|
|||||||
Reference in New Issue
Block a user