diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-05-24 13:00:32 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-05-24 13:00:38 +0800 |
| commit | 135684f1212ccba20324526485a3b66d42be32ca (patch) | |
| tree | 50abaa524a676debeae415ca575843c9856a5995 | |
| parent | 6f4530c511ed5efc1f87d0bb7899144e84f5b3b5 (diff) | |
fixup! feat: kick client (#6)
added comments and explaination
| -rw-r--r-- | src/sessionManager.cpp | 3 |
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); } } |
