Created
August 18, 2019 22:17
-
-
Save caesaneer/769f27865f2eaec48f79b173a4382f2d to your computer and use it in GitHub Desktop.
Part 2 - Worker Threads - Worker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ════════════════════════════════════════════════════════════════════════════════════════════════╡ | |
const { parentPort, workerData } = require('worker_threads') | |
const bench = require('./bench') | |
// ════════════════════════════════════════════════════════════════════════════════════════════════╡ | |
parentPort.on('message', () => { | |
const result = bench(100) | |
parentPort.postMessage(result) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment