build(deps-dev): apply updates
[poolifier.git] / benchmarks / internal / thread-worker.mjs
1 import { isMainThread } from 'node:worker_threads'
2 import { ThreadWorker } from '../../lib/index.mjs'
3 import { executeTaskFunction } from '../benchmarks-utils.cjs'
4 import { TaskFunctions } from '../benchmarks-types.cjs'
5
6 const 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
16 export default new ThreadWorker(taskFunction)