Skip to content

Commit 1549048

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 dabd04d commit 1549048

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
@@ -604,7 +604,10 @@ void Environment::RunCleanup() {
604604
"RunCleanup", this);
605605
CleanupHandles();
606606

607-
while (!cleanup_hooks_.empty()) {
607+
while (!cleanup_hooks_.empty() ||
608+
native_immediates_.size() > 0 ||
609+
native_immediates_threadsafe_.size() > 0 ||
610+
native_immediates_interrupts_.size() > 0) {
608611
// Copy into a vector, since we can't sort an unordered_set in-place.
609612
std::vector<CleanupHookCallback> callbacks(
610613
cleanup_hooks_.begin(), cleanup_hooks_.end());

0 commit comments

Comments
 (0)