Keep event loop alive when refConcurrently has been called (#14068)

This commit is contained in:
190n
2024-09-20 14:57:55 -07:00
committed by GitHub
parent 73c553b25a
commit 08a77267da
6 changed files with 124 additions and 12 deletions

View File

@@ -935,8 +935,12 @@ pub const VirtualMachine = struct {
pub fn isEventLoopAlive(vm: *const VirtualMachine) bool {
return vm.unhandled_error_counter == 0 and
(vm.event_loop_handle.?.isActive() or
vm.active_tasks + vm.event_loop.tasks.count + vm.event_loop.immediate_tasks.count + vm.event_loop.next_immediate_tasks.count > 0);
(@intFromBool(vm.event_loop_handle.?.isActive()) +
vm.active_tasks +
vm.event_loop.tasks.count +
vm.event_loop.immediate_tasks.count +
vm.event_loop.next_immediate_tasks.count +
@intFromBool(vm.event_loop.hasPendingRefs()) > 0);
}
pub fn wakeup(this: *VirtualMachine) void {