Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

threads

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

threads - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

18

dist-esm/master/implementation.node.js

@@ -84,9 +84,10 @@ // tslint:disable function-constructor no-eval max-classes-per-file

}
const terminateAll = () => {
allWorkers.forEach(worker => worker.terminate());
const terminateWorkersAndMaster = () => {
// we should terminate all workers and then gracefully shutdown self process
Promise.all(allWorkers.map(worker => worker.terminate())).then(() => process.exit(0), () => process.exit(1));
allWorkers = [];
};
// Take care to not leave orphaned processes behind. See #147.
process.on("SIGINT", () => terminateAll());
process.on("SIGTERM", () => terminateAll());
process.on("SIGINT", () => terminateWorkersAndMaster());
process.on("SIGTERM", () => terminateWorkersAndMaster());
return Worker;

@@ -126,4 +127,5 @@ }

}
const terminateAll = () => {
allWorkers.forEach(worker => worker.terminate());
const terminateWorkersAndMaster = () => {
// we should terminate all workers and then gracefully shutdown self process
Promise.all(allWorkers.map(worker => worker.terminate())).then(() => process.exit(0), () => process.exit(1));
allWorkers = [];

@@ -133,4 +135,4 @@ };

// See <https://github.com/avoidwork/tiny-worker#faq>
process.on("SIGINT", () => terminateAll());
process.on("SIGTERM", () => terminateAll());
process.on("SIGINT", () => terminateWorkersAndMaster());
process.on("SIGTERM", () => terminateWorkersAndMaster());
return Worker;

@@ -137,0 +139,0 @@ }

@@ -96,9 +96,10 @@ "use strict";

}
const terminateAll = () => {
allWorkers.forEach(worker => worker.terminate());
const terminateWorkersAndMaster = () => {
// we should terminate all workers and then gracefully shutdown self process
Promise.all(allWorkers.map(worker => worker.terminate())).then(() => process.exit(0), () => process.exit(1));
allWorkers = [];
};
// Take care to not leave orphaned processes behind. See #147.
process.on("SIGINT", () => terminateAll());
process.on("SIGTERM", () => terminateAll());
process.on("SIGINT", () => terminateWorkersAndMaster());
process.on("SIGTERM", () => terminateWorkersAndMaster());
return Worker;

@@ -138,4 +139,5 @@ }

}
const terminateAll = () => {
allWorkers.forEach(worker => worker.terminate());
const terminateWorkersAndMaster = () => {
// we should terminate all workers and then gracefully shutdown self process
Promise.all(allWorkers.map(worker => worker.terminate())).then(() => process.exit(0), () => process.exit(1));
allWorkers = [];

@@ -145,4 +147,4 @@ };

// See <https://github.com/avoidwork/tiny-worker#faq>
process.on("SIGINT", () => terminateAll());
process.on("SIGTERM", () => terminateAll());
process.on("SIGINT", () => terminateWorkersAndMaster());
process.on("SIGTERM", () => terminateWorkersAndMaster());
return Worker;

@@ -149,0 +151,0 @@ }

{
"name": "threads",
"version": "1.0.0",
"version": "1.0.1",
"description": "Web workers & worker threads as simple as a function call",

@@ -103,6 +103,10 @@ "main": "dist/index.js",

"worker_threads": false,
"./dist/master/implementation.js": "./dist/master/implementation.browser.js",
"./dist/master/implementation.node.js": false,
"./dist/worker/implementation.js": "./dist/worker/implementation.browser.js",
"./dist/worker/implementation.tiny-worker.js": false,
"./dist/worker/implementation.worker_threads.js": false,
"./dist-esm/master/implementation.js": "./dist-esm/master/implementation.browser.js",
"./dist-esm/master/implementation.node.js": false,
"./dist-esm/worker/implementation.js": "./dist-esm/worker/implementation.browser.js",
"./dist-esm/worker/implementation.tiny-worker.js": false,

@@ -109,0 +113,0 @@ "./dist-esm/worker/implementation.worker_threads.js": false

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc