Skip to content

Commit da3bd57

Browse files
legendecasmhdawson
authored andcommitted
test: fix undoc assumptions about the timing of tsfn calls
PR-URL: #995 Reviewed-By: Michael Dawson <[email protected]>
1 parent 410cf6a commit da3bd57

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

test/threadsafe_function/threadsafe_function.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ async function test(binding) {
2525
binding.threadsafe_function[threadStarter](function testCallback(value) {
2626
array.push(value);
2727
if (array.length === quitAfter) {
28-
setImmediate(() => {
29-
binding.threadsafe_function.stopThread(common.mustCall(() => {
30-
resolve(array);
31-
}), !!abort);
32-
});
28+
binding.threadsafe_function.stopThread(common.mustCall(() => {
29+
resolve(array);
30+
}), !!abort);
3331
}
3432
}, !!abort, !!launchSecondary, maxQueueSize);
3533
if (threadStarter === 'startThreadNonblocking') {

test/typed_threadsafe_function/typed_threadsafe_function.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ async function test(binding) {
2525
binding.typed_threadsafe_function[threadStarter](function testCallback(value) {
2626
array.push(value);
2727
if (array.length === quitAfter) {
28-
setImmediate(() => {
29-
binding.typed_threadsafe_function.stopThread(common.mustCall(() => {
30-
resolve(array);
31-
}), !!abort);
32-
});
28+
binding.typed_threadsafe_function.stopThread(common.mustCall(() => {
29+
resolve(array);
30+
}), !!abort);
3331
}
3432
}, !!abort, !!launchSecondary, maxQueueSize);
3533
if (threadStarter === 'startThreadNonblocking') {

0 commit comments

Comments
 (0)