1 import { isMainThread } from 'node:worker_threads'
3 import { ThreadWorker } from '../../lib/index.mjs'
4 import { TaskFunctions } from '../benchmarks-types.cjs'
5 import { executeTaskFunction } from '../benchmarks-utils.cjs'
7 const taskFunction = data => {
9 data.function = data.function || TaskFunctions.factorial
10 data.debug = data.debug || false
11 const res = executeTaskFunction(data)
12 data.debug === true &&
13 console.debug(`This is the main thread ${isMainThread}`)
17 export default new ThreadWorker(taskFunction)