diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-12-10 16:13:36 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-10 16:13:36 -0500 |
| commit | a3de27ef3bbc5212b2129ed75bab3503da09b9cf (patch) | |
| tree | c0b7d12e3d81df6ff1683c8376442efafbcdf803 /lib/std/os.zig | |
| parent | 55cac65f957fc374e4e369e26bd338f11b8b37ee (diff) | |
| parent | 88e3a7d6dc7289103b8a644aaf6a63437ff6b6b5 (diff) | |
| download | zig-a3de27ef3bbc5212b2129ed75bab3503da09b9cf.tar.gz zig-a3de27ef3bbc5212b2129ed75bab3503da09b9cf.zip | |
Merge pull request #7372 from LemonBoy/atomicint
Improvements for std.atomic.{Int,Bool}
Diffstat (limited to 'lib/std/os.zig')
| -rw-r--r-- | lib/std/os.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig index 3f63869a1a..e3afe90e5d 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -5214,7 +5214,7 @@ pub const CopyFileRangeError = error{ var has_copy_file_range_syscall = init: { const kernel_has_syscall = std.Target.current.os.isAtLeast(.linux, .{ .major = 4, .minor = 5 }) orelse true; - break :init std.atomic.Int(bool).init(kernel_has_syscall); + break :init std.atomic.Bool.init(kernel_has_syscall); }; /// Transfer data between file descriptors at specified offsets. @@ -5246,7 +5246,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len const use_c = std.c.versionCheck(.{ .major = 2, .minor = 27, .patch = 0 }).ok; if (std.Target.current.os.tag == .linux and - (use_c or has_copy_file_range_syscall.get())) + (use_c or has_copy_file_range_syscall.load(.Monotonic))) { const sys = if (use_c) std.c else linux; @@ -5271,7 +5271,7 @@ pub fn copy_file_range(fd_in: fd_t, off_in: u64, fd_out: fd_t, off_out: u64, len EXDEV => {}, // syscall added in Linux 4.5, use fallback ENOSYS => { - has_copy_file_range_syscall.set(false); + has_copy_file_range_syscall.store(true, .Monotonic); }, else => |err| return unexpectedErrno(err), } |
