authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-13 14:31:19-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-05-13 14:31:30-07:00
logc30edd78f9ed65c5659f86a63a9b59a88838c618
treeb2ab9adfcd676f170fd6245086cb3f8d254e5211
parentb986fcfc996ec54e2f755b1161df1a6ceac009d4

std.Progress: activate() calls maybeRefresh()

This makes the progress bar display the ongoing operation in the case that the API user calls activate().

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

lib/std/Progress.zig+4-1
...@@ -93,7 +93,9 @@ pub const Node = struct {...@@ -93,7 +93,9 @@ pub const Node = struct {
9393
94 /// This is the same as calling `start` and then `end` on the returned `Node`. Thread-safe.94 /// This is the same as calling `start` and then `end` on the returned `Node`. Thread-safe.
95 pub fn completeOne(self: *Node) void {95 pub fn completeOne(self: *Node) void {
96 self.activate();96 if (self.parent) |parent| {
97 @atomicStore(?*Node, &parent.recently_updated_child, self, .Release);
98 }
97 _ = @atomicRmw(usize, &self.unprotected_completed_items, .Add, 1, .Monotonic);99 _ = @atomicRmw(usize, &self.unprotected_completed_items, .Add, 1, .Monotonic);
98 self.context.maybeRefresh();100 self.context.maybeRefresh();
99 }101 }
...@@ -120,6 +122,7 @@ pub const Node = struct {...@@ -120,6 +122,7 @@ pub const Node = struct {
120 pub fn activate(self: *Node) void {122 pub fn activate(self: *Node) void {
121 if (self.parent) |parent| {123 if (self.parent) |parent| {
122 @atomicStore(?*Node, &parent.recently_updated_child, self, .Release);124 @atomicStore(?*Node, &parent.recently_updated_child, self, .Release);
125 self.context.maybeRefresh();
123 }126 }
124 }127 }
125128