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