GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: call unmask after install signal handler · nodejs/node@55838e7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • inspector_agent.cc
    • node_watchdog.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/inspector_agent.cc‎

Copy file name to clipboardExpand all lines: src/inspector_agent.cc
+5-4Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,11 @@ static int StartDebugSignalHandler() {
123123
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &savemask));
124124
sigmask = savemask;
125125
pthread_t thread;
126-
const int err = pthread_create(&thread, &attr,
127-
StartIoThreadMain, nullptr);
128-
// Restore original mask
129-
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr));
126+
const int err = pthread_create(&thread, &attr, StartIoThreadMain, nullptr);
130127
CHECK_EQ(0, pthread_attr_destroy(&attr));
131128
if (err != 0) {
129+
// Restore original mask
130+
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr));
132131
fprintf(stderr, "node[%u]: pthread_create: %s\n",
133132
uv_os_getpid(), strerror(err));
134133
fflush(stderr);
@@ -137,6 +136,8 @@ static int StartDebugSignalHandler() {
137136
return -err;
138137
}
139138
RegisterSignalHandler(SIGUSR1, StartIoThreadWakeup);
139+
// Restore original mask
140+
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr));
140141
// Unblock SIGUSR1. A pending SIGUSR1 signal will now be delivered.
141142
sigemptyset(&sigmask);
142143
sigaddset(&sigmask, SIGUSR1);
Collapse file

‎src/node_watchdog.cc‎

Copy file name to clipboardExpand all lines: src/node_watchdog.cc
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ int SigintWatchdogHelper::Start() {
308308
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, &savemask));
309309
sigmask = savemask;
310310
int ret = pthread_create(&thread_, nullptr, RunSigintWatchdog, nullptr);
311-
CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr));
311+
312+
auto cleanup = OnScopeLeave(
313+
[&]() { CHECK_EQ(0, pthread_sigmask(SIG_SETMASK, &sigmask, nullptr)); });
314+
312315
if (ret != 0) {
313316
return ret;
314317
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.