const {
Worker, isMainThread, MessageChannel, SHARE_ENV
} = require('worker_threads')
const {
Worker, isMainThread, MessageChannel, SHARE_ENV
} = require('worker_threads')
// configure worker to handle message with the specified task
const worker = this._chooseWorker()
this.tasks.set(worker, this.tasks.get(worker) + 1)
// configure worker to handle message with the specified task
const worker = this._chooseWorker()
this.tasks.set(worker, this.tasks.get(worker) + 1)
const res = this._execute(worker, id)
worker.postMessage({ data: data, _id: id })
return res
const res = this._execute(worker, id)
worker.postMessage({ data: data, _id: id })
return res