summaryrefslogtreecommitdiff
path: root/src/sessionManager.cpp
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2025-05-24 13:00:32 +0800
committerlittleblack111 <littleblack11111@gmail.com>2025-05-24 13:00:38 +0800
commit135684f1212ccba20324526485a3b66d42be32ca (patch)
tree50abaa524a676debeae415ca575843c9856a5995 /src/sessionManager.cpp
parent6f4530c511ed5efc1f87d0bb7899144e84f5b3b5 (diff)
fixup! feat: kick client (#6)
added comments and explaination
Diffstat (limited to 'src/sessionManager.cpp')
-rw-r--r--src/sessionManager.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sessionManager.cpp b/src/sessionManager.cpp
index add9015..f43bd2d 100644
--- a/src/sessionManager.cpp
+++ b/src/sessionManager.cpp
@@ -126,6 +126,9 @@ void CSessionManager::kick(std::pair<std::jthread, std::shared_ptr<CSession>> *s
it->second.reset();
m_vSessions.erase(it);
if (kill && native_handle != 0)
+ // cancel(terminal/kill) the thread if it doesn't exit on its own
+ // pthread_cancel cuz it's the safest https://stackoverflow.com/a/3438576
+ // need a condition because it might crash if the thread is already dead
pthread_cancel(native_handle);
}
}