From c30edd78f9ed65c5659f86a63a9b59a88838c618 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 13 May 2022 14:31:19 -0700 Subject: [PATCH] std.Progress: activate() calls maybeRefresh() This makes the progress bar display the ongoing operation in the case that the API user calls activate(). --- lib/std/Progress.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/std/Progress.zig b/lib/std/Progress.zig index 07f9077844..925cefcb74 100644 --- a/lib/std/Progress.zig +++ b/lib/std/Progress.zig @@ -93,7 +93,9 @@ pub const Node = struct { /// This is the same as calling `start` and then `end` on the returned `Node`. Thread-safe. pub fn completeOne(self: *Node) void { - self.activate(); + if (self.parent) |parent| { + @atomicStore(?*Node, &parent.recently_updated_child, self, .Release); + } _ = @atomicRmw(usize, &self.unprotected_completed_items, .Add, 1, .Monotonic); self.context.maybeRefresh(); } @@ -120,6 +122,7 @@ pub const Node = struct { pub fn activate(self: *Node) void { if (self.parent) |parent| { @atomicStore(?*Node, &parent.recently_updated_child, self, .Release); + self.context.maybeRefresh(); } }