kl-threadpool
v1.0.5
Published
a threadpool tools
Downloads
16
Readme
threadpool.js
A thread-pool abstraction for node operations__
Install
npm install --save kl-threadpool
Usage
Task Thread:
ThreadPool.run(({test, resolve, reject, listener, work}) => {
listener(test + 1)
resolve(test + 2);
}, {
listener:(res)=>{
console.log(res)
},
test: 123456,
}).then((test) => {
console.log(test)
})
Resident Thread:
let worker = ThreadPool.addThread();
worker.run(({test, resolve, reject, listener}) => {
listener(test)
listener(test + 1)
resolve(test + 2);
}, {
listener: (res) => {
console.log(res)
},
test: 123456,
}).then((res) => {
console.log(res)
})