Skip to content

Commit

Permalink
test: fix undoc assumptions about the timing of tsfn calls
Browse files Browse the repository at this point in the history
PR-URL: #995
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
legendecas authored and mhdawson committed May 11, 2021
1 parent 410cf6a commit da3bd57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 3 additions & 5 deletions test/threadsafe_function/threadsafe_function.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ async function test(binding) {
binding.threadsafe_function[threadStarter](function testCallback(value) {
array.push(value);
if (array.length === quitAfter) {
setImmediate(() => {
binding.threadsafe_function.stopThread(common.mustCall(() => {
resolve(array);
}), !!abort);
});
binding.threadsafe_function.stopThread(common.mustCall(() => {
resolve(array);
}), !!abort);
}
}, !!abort, !!launchSecondary, maxQueueSize);
if (threadStarter === 'startThreadNonblocking') {
Expand Down
8 changes: 3 additions & 5 deletions test/typed_threadsafe_function/typed_threadsafe_function.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ async function test(binding) {
binding.typed_threadsafe_function[threadStarter](function testCallback(value) {
array.push(value);
if (array.length === quitAfter) {
setImmediate(() => {
binding.typed_threadsafe_function.stopThread(common.mustCall(() => {
resolve(array);
}), !!abort);
});
binding.typed_threadsafe_function.stopThread(common.mustCall(() => {
resolve(array);
}), !!abort);
}
}, !!abort, !!launchSecondary, maxQueueSize);
if (threadStarter === 'startThreadNonblocking') {
Expand Down

0 comments on commit da3bd57

Please sign in to comment.