| ... | @@ -104,8 +104,8 @@ pub const Node = struct { | ... | @@ -104,8 +104,8 @@ pub const Node = struct { |
| 104 | // `estimated_total_count` max int indicates the special state that | 104 | // `estimated_total_count` max int indicates the special state that |
| 105 | // causes `completed_count` to be treated as a file descriptor, so | 105 | // causes `completed_count` to be treated as a file descriptor, so |
| 106 | // the order here matters. | 106 | // the order here matters. |
| 107 | @atomicStore(u32, &s.completed_count, integer, .seq_cst); | 107 | @atomicStore(u32, &s.completed_count, integer, .monotonic); |
| 108 | @atomicStore(u32, &s.estimated_total_count, std.math.maxInt(u32), .seq_cst); | 108 | @atomicStore(u32, &s.estimated_total_count, std.math.maxInt(u32), .release); |
| 109 | } | 109 | } |
| 110 | | 110 | |
| 111 | /// Not thread-safe. | 111 | /// Not thread-safe. |
| ... | @@ -590,13 +590,13 @@ fn serialize(serialized_buffer: *Serialized.Buffer) Serialized { | ... | @@ -590,13 +590,13 @@ fn serialize(serialized_buffer: *Serialized.Buffer) Serialized { |
| 590 | const node_parents = global_progress.node_parents[0..end_index]; | 590 | const node_parents = global_progress.node_parents[0..end_index]; |
| 591 | const node_storage = global_progress.node_storage[0..end_index]; | 591 | const node_storage = global_progress.node_storage[0..end_index]; |
| 592 | for (node_parents, node_storage, 0..) |*parent_ptr, *storage_ptr, i| { | 592 | for (node_parents, node_storage, 0..) |*parent_ptr, *storage_ptr, i| { |
| 593 | var begin_parent = @atomicLoad(Node.Parent, parent_ptr, .seq_cst); | 593 | var begin_parent = @atomicLoad(Node.Parent, parent_ptr, .acquire); |
| 594 | while (begin_parent != .unused) { | 594 | while (begin_parent != .unused) { |
| 595 | const dest_storage = &serialized_buffer.storage[serialized_len]; | 595 | const dest_storage = &serialized_buffer.storage[serialized_len]; |
| 596 | @memcpy(&dest_storage.name, &storage_ptr.name); | 596 | @memcpy(&dest_storage.name, &storage_ptr.name); |
| 597 | dest_storage.completed_count = @atomicLoad(u32, &storage_ptr.completed_count, .seq_cst); | 597 | dest_storage.estimated_total_count = @atomicLoad(u32, &storage_ptr.estimated_total_count, .acquire); |
| 598 | dest_storage.estimated_total_count = @atomicLoad(u32, &storage_ptr.estimated_total_count, .seq_cst); | 598 | dest_storage.completed_count = @atomicLoad(u32, &storage_ptr.completed_count, .monotonic); |
| 599 | const end_parent = @atomicLoad(Node.Parent, parent_ptr, .seq_cst); | 599 | const end_parent = @atomicLoad(Node.Parent, parent_ptr, .acquire); |
| 600 | if (begin_parent == end_parent) { | 600 | if (begin_parent == end_parent) { |
| 601 | any_ipc = any_ipc or (dest_storage.getIpcFd() != null); | 601 | any_ipc = any_ipc or (dest_storage.getIpcFd() != null); |
| 602 | serialized_buffer.parents[serialized_len] = begin_parent; | 602 | serialized_buffer.parents[serialized_len] = begin_parent; |