Skip to content

Commit 09c5942

Browse files
addaleaxjasnell
authored andcommitted
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 9511261 commit 09c5942

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/env.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,10 @@ void Environment::RunCleanup() {
634634
initial_base_object_count_ = 0;
635635
CleanupHandles();
636636

637-
while (!cleanup_hooks_.empty()) {
637+
while (!cleanup_hooks_.empty() ||
638+
native_immediates_.size() > 0 ||
639+
native_immediates_threadsafe_.size() > 0 ||
640+
native_immediates_interrupts_.size() > 0) {
638641
// Copy into a vector, since we can't sort an unordered_set in-place.
639642
std::vector<CleanupHookCallback> callbacks(
640643
cleanup_hooks_.begin(), cleanup_hooks_.end());

0 commit comments

Comments
 (0)