({
threadStarter,
quitAfter,
abort,
maxQueueSize,
launchSecondary,
})
| 32 | } |
| 33 | |
| 34 | function testWithJSMarshaller({ |
| 35 | threadStarter, |
| 36 | quitAfter, |
| 37 | abort, |
| 38 | maxQueueSize, |
| 39 | launchSecondary, |
| 40 | }) { |
| 41 | return new Promise((resolve) => { |
| 42 | const array = []; |
| 43 | binding[threadStarter](function testCallback(value) { |
| 44 | array.push(value); |
| 45 | if (array.length === quitAfter) { |
| 46 | setImmediate(() => { |
| 47 | binding.StopThread(() => { |
| 48 | resolve(array); |
| 49 | }, !!abort); |
| 50 | }); |
| 51 | } |
| 52 | }, !!abort, !!launchSecondary, maxQueueSize); |
| 53 | if (threadStarter === 'StartThreadNonblocking') { |
| 54 | // Let's make this thread really busy for a short while to ensure that |
| 55 | // the queue fills and the thread receives a napi_queue_full. |
| 56 | const start = Date.now(); |
| 57 | while (Date.now() - start < 200); |
| 58 | } |
| 59 | }); |
| 60 | } |
| 61 | |
| 62 | function testUnref(queueSize) { |
| 63 | return new Promise((resolve, reject) => { |
no test coverage detected
searching dependent graphs…