authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-11 22:23:03-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-01-11 22:23:03-07:00
log8ea2b40e5f621482d714fdd7cb05bbc592fc550b
treed469f4843a89edeff955926f0de9e10e5392792c
parent0edde40c25c033aec67f235365593ee26ff52740

std.event.Loop: fix race condition when starting the time wheel

closes #7572

1 files changed, 2 insertions(+), 1 deletions(-)

lib/std/event/loop.zig+2-1
......@@ -796,9 +796,10 @@ pub const Loop = struct {
796796 .waiters = DelayQueue.Waiters{
797797 .entries = std.atomic.Queue(anyframe).init(),
798798 },
799 .thread = try std.Thread.spawn(self, DelayQueue.run),
800799 .event = std.AutoResetEvent{},
801800 .is_running = true,
801 // Must be last so that it can read the other state, such as `is_running`.
802 .thread = try std.Thread.spawn(self, DelayQueue.run),
802803 };
803804 }
804805