X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2FyourWorker.js;h=3e59f3465db2269fbb4ed2827f3c048c6010a8b8;hb=3f4ea67d53a545d40330c9428b570da47299b313;hp=ac3959d121f1fcfa123f1118374a1c4b3d2bcf4f;hpb=1f9a5a440caea7dc60a664d413304250969bb4d8;p=poolifier.git diff --git a/examples/yourWorker.js b/examples/yourWorker.js index ac3959d1..3e59f346 100644 --- a/examples/yourWorker.js +++ b/examples/yourWorker.js @@ -1,5 +1,8 @@ 'use strict' -const { ThreadWorker } = require('../lib/workers') +const { ThreadWorker } = require('poolifier') +const { isMainThread } = require('worker_threads') + +const debug = false function yourFunction (data) { for (let i = 0; i <= 1000; i++) { @@ -8,7 +11,7 @@ function yourFunction (data) { } JSON.stringify(o) } - // console.log('This is the main thread ' + isMainThread) + debug === true && console.log('This is the main thread ' + isMainThread) return { ok: 1 } }