diff --git a/lib/std/event/loop.zig b/lib/std/event/loop.zig index f5df637f37c5b49d5155227158c70c278d000014..8101d27a559e96bd8a0d3aac2ff0a806aef22036 100644 --- a/lib/std/event/loop.zig +++ b/lib/std/event/loop.zig @@ -796,9 +796,10 @@ pub const Loop = struct { .waiters = DelayQueue.Waiters{ .entries = std.atomic.Queue(anyframe).init(), }, - .thread = try std.Thread.spawn(self, DelayQueue.run), .event = std.AutoResetEvent{}, .is_running = true, + // Must be last so that it can read the other state, such as `is_running`. + .thread = try std.Thread.spawn(self, DelayQueue.run), }; }