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,test: add regression test for nested Worker termination · nodejs/node@055c568

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • env.cc
  • test/parallel
    • test-worker-terminate-nested.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/env.cc‎

Copy file name to clipboardExpand all lines: src/env.cc
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,8 @@ void Environment::Exit(int exit_code) {
978978
}
979979

980980
void Environment::stop_sub_worker_contexts() {
981+
DCHECK_EQ(Isolate::GetCurrent(), isolate());
982+
981983
while (!sub_worker_contexts_.empty()) {
982984
Worker* w = *sub_worker_contexts_.begin();
983985
remove_sub_worker_context(w);
Collapse file

‎test/parallel/test-worker-terminate-nested.js‎

Copy file name to clipboard
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
'use strict';
2+
const common = require('../common');
3+
const { Worker } = require('worker_threads');
4+
5+
// Check that a Worker that's running another Worker can be terminated.
6+
7+
const worker = new Worker(`
8+
const { Worker, parentPort } = require('worker_threads');
9+
const worker = new Worker('setInterval(() => {}, 10);', { eval: true });
10+
worker.on('online', () => {
11+
parentPort.postMessage({});
12+
});
13+
`, { eval: true });
14+
15+
worker.on('message', common.mustCall(() => worker.terminate()));

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.