docs: add changelog entry for IWRR worker choice strategy
[poolifier.git] / benchmarks / internal / thread-worker.js
1 'use strict'
2 const { isMainThread } = require('worker_threads')
3 const { ThreadWorker } = require('../../lib')
4 const { executeWorkerFunction } = require('../benchmarks-utils')
5 const { WorkerFunctions } = require('../benchmarks-types')
6
7 const debug = false
8
9 function yourFunction (data) {
10 data = data || {}
11 data.function = data.function || WorkerFunctions.jsonIntegerSerialization
12 executeWorkerFunction(data)
13 debug === true && console.debug('This is the main thread ' + isMainThread)
14 return { ok: 1 }
15 }
16
17 module.exports = new ThreadWorker(yourFunction)