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 — worker: fix deadlock when calling terminate from exit handler · nodejs/node@677d10c

File tree

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

‎src/node_worker.cc‎

Copy file name to clipboardExpand all lines: src/node_worker.cc
+12-12Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -287,22 +287,21 @@ void Worker::JoinThread() {
287287
}
288288

289289
void Worker::OnThreadStopped() {
290-
Mutex::ScopedLock lock(mutex_);
291-
scheduled_on_thread_stopped_ = false;
290+
{
291+
Mutex::ScopedLock lock(mutex_);
292+
scheduled_on_thread_stopped_ = false;
292293

293-
Debug(this, "Worker %llu thread stopped", thread_id_);
294+
Debug(this, "Worker %llu thread stopped", thread_id_);
294295

295-
{
296-
Mutex::ScopedLock stopped_lock(stopped_mutex_);
297-
CHECK(stopped_);
298-
}
296+
{
297+
Mutex::ScopedLock stopped_lock(stopped_mutex_);
298+
CHECK(stopped_);
299+
}
299300

300-
CHECK_EQ(child_port_, nullptr);
301-
parent_port_ = nullptr;
301+
CHECK_EQ(child_port_, nullptr);
302+
parent_port_ = nullptr;
303+
}
302304

303-
// It's okay to join the thread while holding the mutex because
304-
// OnThreadStopped means it's no longer doing any work that might grab it
305-
// and really just silently exiting.
306305
JoinThread();
307306

308307
{
@@ -369,6 +368,7 @@ void Worker::StopThread(const FunctionCallbackInfo<Value>& args) {
369368
Worker* w;
370369
ASSIGN_OR_RETURN_UNWRAP(&w, args.This());
371370

371+
Debug(w, "Worker %llu is getting stopped by parent", w->thread_id_);
372372
w->Exit(1);
373373
w->JoinThread();
374374
}

0 commit comments

Comments
0 (0)
You are visitor 01402775 — 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.