build(deps-dev): apply updates
[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.mjs'
4import { TaskFunctions } from '../benchmarks-types.mjs'
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)