X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=examples%2FyourWorker.js;h=b2df8d19093527e0ca67a24f9f84589ab1207050;hb=a109e1c64ce3cff450fa79aebfa4de0ac3662be9;hp=4597f6485b0073f01854c8285213c5e27ed689fb;hpb=60fbd6d6188b0902d157fd0cde04d6af3a391e32;p=poolifier.git diff --git a/examples/yourWorker.js b/examples/yourWorker.js index 4597f648..b2df8d19 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.info('This is the main thread ' + isMainThread) return { ok: 1 } }