Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example of cross realm abort signal #1

Open
bmeck opened this issue Mar 16, 2022 · 0 comments
Open

example of cross realm abort signal #1

bmeck opened this issue Mar 16, 2022 · 0 comments

Comments

@bmeck
Copy link
Member

bmeck commented Mar 16, 2022

const worker_threads = require('worker_threads');
const controller = new AbortController();
const {signal} = controller;
new worker_threads.Worker(`
  setTimeout(() => console.log(require('worker_threads').workerData.aborted), 50);
  console.log('ready!')
`, {
  eval: true,
  workerData: signal,
  transferList: [ signal ]
});
setTimeout(() => controller.abort(), 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant