removed shared memory in destructor

This commit is contained in:
2026-05-29 15:55:12 +02:00
parent 92c9a56804
commit 3e6d9b56a3
2 changed files with 8 additions and 1 deletions
@@ -70,6 +70,8 @@ template <typename DerivedDetectorServer> class DetectorServer {
*/
explicit DetectorServer(uint16_t port = DEFAULT_TCP_CNTRL_PORTNO);
~DetectorServer();
protected:
/// @brief TCP/IP interface for communication with the client
std::unique_ptr<TCPInterface> tcpInterface;
@@ -147,6 +149,11 @@ DetectorServer<DerivedDetectorServer>::DetectorServer(uint16_t port) {
tcpInterface = std::make_unique<TCPInterface>(fn, port);
}
template <typename DerivedDetectorServer>
DetectorServer<DerivedDetectorServer>::~DetectorServer() {
shm.removeSharedMemory();
}
template <typename DerivedDetectorServer>
ReturnCode DetectorServer<DerivedDetectorServer>::processFunction(
const detFuncs function_id, ServerInterface &socket) {
+1 -1
View File
@@ -92,7 +92,7 @@ template <typename T> class SharedMemory {
~SharedMemory() {
if (shared_struct)
unmapSharedMemory();
unmapSharedMemory(); // only unmapped as resued in command line
}
/** memory is valid if it has the IsValid flag and is true */