Skip to content

Commit 2565409

Browse files
committed
reject long timeouts as we're shutting down
1 parent 3c07c08 commit 2565409

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/runtime/loop.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ pub const Loop = struct {
193193
}
194194

195195
pub fn timeout(self: *Self, nanoseconds: u63, callback_node: ?*CallbackNode) !usize {
196+
if (self.stopping and nanoseconds > std.time.ns_per_ms * 500) {
197+
// we're trying to shutdown, we probably don't want to wait for a new
198+
// long timeout
199+
return 0;
200+
}
196201
const completion = try self.alloc.create(Completion);
197202
errdefer self.alloc.destroy(completion);
198203
completion.* = undefined;

0 commit comments

Comments
 (0)