X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=examples%2FyourWorker.js;h=7de9485ceb1a228075011e615fb802d7660185b4;hb=8a11bce46f69f1183d025572345755d4fd40231b;hp=4597f6485b0073f01854c8285213c5e27ed689fb;hpb=60fbd6d6188b0902d157fd0cde04d6af3a391e32;p=poolifier.git diff --git a/examples/yourWorker.js b/examples/yourWorker.js index 4597f648..7de9485c 100644 --- a/examples/yourWorker.js +++ b/examples/yourWorker.js @@ -1,14 +1,17 @@ 'use strict' +const { isMainThread } = require('worker_threads') const { ThreadWorker } = require('poolifier') -function yourFunction (data) { +const debug = false + +function yourFunction () { for (let i = 0; i <= 1000; i++) { const o = { a: i } JSON.stringify(o) } - // console.log('This is the main thread ' + isMainThread) + debug === true && console.log('This is the main thread ' + isMainThread) return { ok: 1 } }