commit e86a1df9f23386cc315ac8055ecfe7a6465c5ee3 (tree)
parent dfb34c315576525806a471ae0c4f94b76d362bf9
Author: Hadron67 <604700341@qq.com>
Date: Sun, 18 Apr 2021 15:47:27 +0800
std.atomic: load should take const pointer to Self
Diffstat:
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/std/atomic/bool.zig b/lib/std/atomic/bool.zig
@@ -28,7 +28,7 @@ pub const Bool = extern struct {
return @atomicRmw(bool, &self.unprotected_value, .Xchg, operand, ordering);
}
- pub fn load(self: *Self, comptime ordering: std.builtin.AtomicOrder) bool {
+ pub fn load(self: *const Self, comptime ordering: std.builtin.AtomicOrder) bool {
switch (ordering) {
.Unordered, .Monotonic, .Acquire, .SeqCst => {},
else => @compileError("Invalid ordering '" ++ @tagName(ordering) ++ "' for a load operation"),
diff --git a/lib/std/atomic/int.zig b/lib/std/atomic/int.zig
@@ -31,7 +31,7 @@ pub fn Int(comptime T: type) type {
return @atomicRmw(T, &self.unprotected_value, op, operand, ordering);
}
- pub fn load(self: *Self, comptime ordering: builtin.AtomicOrder) T {
+ pub fn load(self: *const Self, comptime ordering: builtin.AtomicOrder) T {
switch (ordering) {
.Unordered, .Monotonic, .Acquire, .SeqCst => {},
else => @compileError("Invalid ordering '" ++ @tagName(ordering) ++ "' for a load operation"),
@@ -59,7 +59,7 @@ pub fn Int(comptime T: type) type {
return self.rmw(.Sub, 1, .SeqCst);
}
- pub fn get(self: *Self) T {
+ pub fn get(self: *const Self) T {
return self.load(.SeqCst);
}