X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2FyourWorker.js;h=5bd1ad6569c212b560d3eb829352f8974417b4a3;hb=710826bc287a006d90f9cdda42fdbac655757973;hp=4597f6485b0073f01854c8285213c5e27ed689fb;hpb=60fbd6d6188b0902d157fd0cde04d6af3a391e32;p=poolifier.git diff --git a/examples/yourWorker.js b/examples/yourWorker.js index 4597f648..5bd1ad65 100644 --- a/examples/yourWorker.js +++ b/examples/yourWorker.js @@ -1,14 +1,17 @@ 'use strict' const { ThreadWorker } = require('poolifier') +const { isMainThread } = require('worker_threads') -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 } }