Skip to content

Commit 08997ee

Browse files
committed
chore: no need to drain queue in callback
1 parent 55541ae commit 08997ee

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

packages/host/cpp/ThreadsafeFunction.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,6 @@ napi_status ThreadSafeFunction::call(
171171
// Auto-finalize when: no remaining threads (acquire/release balance),
172172
// queue drained, and not already closing.
173173
if (!self->threadCount_ && empty) {
174-
// if (self->maxQueueSize_) {
175-
// std::lock_guard lock{self->queueMutex_};
176-
// self->queueCv_.notify_all();
177-
// }
178174
self->finalize();
179175
}
180176
});
@@ -228,10 +224,10 @@ napi_status ThreadSafeFunction::unref() {
228224
}
229225

230226
void ThreadSafeFunction::finalize() {
231-
if (handlesClosing_) {
227+
if (finalizeScheduled_) {
232228
return;
233229
}
234-
handlesClosing_ = true;
230+
finalizeScheduled_ = true;
235231
closing_ = true;
236232

237233
const auto onFinalize = [self = shared_from_this()] {

0 commit comments

Comments
 (0)