summaryrefslogtreecommitdiff
path: root/src/sessionManager.cpp
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-03-11 09:30:16 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-03-20 23:44:58 +0800
commitf7c182585b32e4fbfae7cf26e91eb193216828ec (patch)
tree71993018509d92024387c65680efefcc0b18aa5e /src/sessionManager.cpp
parent53c075e2927c33355c6a108a102726f585d24119 (diff)
signal(session,sessionManager): atexit handler
sometimes have malloc: Heap corruption detected :/
Diffstat (limited to 'src/sessionManager.cpp')
-rw-r--r--src/sessionManager.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/sessionManager.cpp b/src/sessionManager.cpp
index f4573e1..b4e1ad5 100644
--- a/src/sessionManager.cpp
+++ b/src/sessionManager.cpp
@@ -6,7 +6,15 @@
#include <utility>
#include "log.hpp"
+void CSessionManager::shutdownSessions() {
+ for (const auto &[thread, session] : m_vSessions)
+ session->onShutdown();
+}
+
CSessionManager::CSessionManager() {
+ if (std::atexit([]() { g_pSessionManager->shutdownSessions(); }))
+ log(ERR, "Failed to register SessionManager atexit handler, will fallback to quick_exit after hang");
+
log(LOG, "SessionManager: initialized");
};