std.atomic: load should take const pointer to Self

This commit is contained in:
Hadron67 2021-04-18 15:47:27 +08:00 committed by Isaac Freund
parent dfb34c3155
commit e86a1df9f2
2 changed files with 3 additions and 3 deletions

View File

@ -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"),

View File

@ -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);
}