Commit | Line | Data |
---|---|---|
583a27ce | 1 | const workerpool = require('workerpool') |
57df5469 | 2 | |
106744f7 | 3 | function yourFunction (data) { |
4 | for (let i = 0; i <= 1000; i++) { | |
5 | const o = { | |
6 | a: i | |
7 | } | |
8 | JSON.stringify(o) | |
9 | } | |
10 | // console.log('This is the main thread ' + isMainThread) | |
11 | return { ok: 1 } | |
12 | } | |
13 | ||
583a27ce JB |
14 | workerpool.worker({ |
15 | yourFunction: yourFunction | |
16 | }) |