fix: fix formatting issue.
[poolifier.git] / benchmarks / internal / thread-worker.mjs
CommitLineData
8a970421
JB
1import { isMainThread } from 'worker_threads'
2import { ThreadWorker } from '../../lib/index.mjs'
dbca3be9
JB
3import { executeTaskFunction } from '../benchmarks-utils.mjs'
4import { TaskFunctions } from '../benchmarks-types.mjs'
8a970421
JB
5
6const debug = false
7
041dc05b 8const taskFunction = data => {
8a970421 9 data = data || {}
dbca3be9
JB
10 data.function = data.function || TaskFunctions.jsonIntegerSerialization
11 const res = executeTaskFunction(data)
1c132fec 12 debug === true && console.debug(`This is the main thread ${isMainThread}`)
30b963d4 13 return res
8a970421
JB
14}
15
dbca3be9 16export default new ThreadWorker(taskFunction)