Benchmarks: properly parse env variables
[poolifier.git] / benchmarks / internal / thread / worker.js
CommitLineData
57df5469 1'use strict'
23ff945a 2const { isMainThread } = require('worker_threads')
be0676b3 3const { ThreadWorker } = require('../../../lib/index')
d1a9aa41
JB
4const {
5 WorkerFunctions,
6 executeWorkerFunction
7} = require('../../benchmarks-utils')
57df5469 8
23ff945a
JB
9const debug = false
10
106744f7 11function yourFunction (data) {
2d2e32c2
JB
12 data = data || {}
13 data.function = data.function || WorkerFunctions.jsonIntegerSerialization
14 executeWorkerFunction(data)
23ff945a 15 debug === true && console.debug('This is the main thread ' + isMainThread)
106744f7 16 return { ok: 1 }
17}
18
1f9a5a44 19module.exports = new ThreadWorker(yourFunction)