_newWorker () {
const worker = new Worker(path.resolve(this.filename), { env: SHARE_ENV })
worker.on('error', this.opts.errorHandler || empty)
- worker.on('exit', this.opts.exitHandler || empty)
worker.on('online', this.opts.onlineHandler || empty)
+ // TODO remove the workers array , use only the map data structure
+ // handle properly when a thread exit
+ worker.on('exit', this.opts.exitHandler || empty)
this.workers.push(worker)
const { port1, port2 } = new MessageChannel()
worker.postMessage({ parent: port1 }, [port1])