Skip to content

Commit 2761f34

Browse files
committed
src: spin shutdown loop while immediates are pending
This allows using `SetImmediate()` and friends at any point during cleanup. PR-URL: #34662 Fixes: #34657 Refs: #34572 Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 39ca48c commit 2761f34

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/env.cc

+4-1
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,10 @@ void Environment::RunCleanup() {
593593
initial_base_object_count_ = 0;
594594
CleanupHandles();
595595

596-
while (!cleanup_hooks_.empty()) {
596+
while (!cleanup_hooks_.empty() ||
597+
native_immediates_.size() > 0 ||
598+
native_immediates_threadsafe_.size() > 0 ||
599+
native_immediates_interrupts_.size() > 0) {
597600
// Copy into a vector, since we can't sort an unordered_set in-place.
598601
std::vector<CleanupHookCallback> callbacks(
599602
cleanup_hooks_.begin(), cleanup_hooks_.end());

0 commit comments

Comments
 (0)