Browse Source

chatgui: fix Ctrl-C on Linux — remove thread_local from g_currentNode

SIGINT on Linux can be delivered to any thread (not just worker).
signal_handler uses g_currentNode->requestStop(); with thread_local,
g_currentNode was nullptr in non-worker threads — Ctrl-C did nothing.

Removing thread_local fixes signal delivery: g_currentNode is set once
before signal handler is registered, pointer read is atomic on x86/x64.
topo_upd
Evgeny 2 months ago
parent
commit
df8d910efa
  1. 2
      tools/chatgui/transport/utun_node.cpp

2
tools/chatgui/transport/utun_node.cpp

@ -33,7 +33,7 @@ extern "C" {
#define ETCP_RT_ID_CHAT 0x11 #define ETCP_RT_ID_CHAT 0x11
static thread_local UtunNode* g_currentNode = nullptr; static UtunNode* g_currentNode = nullptr;
static void signal_handler(int sig) { static void signal_handler(int sig) {
(void)sig; (void)sig;

Loading…
Cancel
Save