Merge dependabot/npm_and_yarn/examples/typescript/smtp-client-pool/types/node-20...
[poolifier.git] / benchmarks / internal / thread-worker.mjs
... / ...
CommitLineData
1import { isMainThread } from 'node:worker_threads'
2import { ThreadWorker } from '../../lib/index.mjs'
3import { executeTaskFunction } from '../benchmarks-utils.cjs'
4import { TaskFunctions } from '../benchmarks-types.cjs'
5
6const taskFunction = data => {
7 data = data || {}
8 data.function = data.function || TaskFunctions.jsonIntegerSerialization
9 data.debug = data.debug || false
10 const res = executeTaskFunction(data)
11 data.debug === true &&
12 console.debug(`This is the main thread ${isMainThread}`)
13 return res
14}
15
16export default new ThreadWorker(taskFunction)